- hosts: cluster
  tasks:
 
  - name: yum update
    yum: name=* state=latest
 
  - name: install beegfs repogitory
    get_url:
      url: https://www.beegfs.io/release/beegfs_7_1/dists/beegfs-rhel7.repo
      dest: /etc/yum.repos.d/beegfs-rhel7.repo
  - name: yum group install
    yum: name="@Development Tools" state=present
  - name: yum install kernel-devel beegfs-client beegfs-helperd
    yum:
     name: "{{ packages } }"
    vars:
     packages:
     - kernel-devel
     - beegfs-client
     - beegfs-helperd
  - name: disable beegfs daemon
    systemd:
     name: "{{ item } }"
     enabled: no
    with_items:
     - 'beegfs-client.service'
     - 'beegfs-helperd.service'
  - name: make directory
    file: path=/etc/beegfs/{{ item } } state=directory
    with_items:
    - inst1.d
    - inst2.d
  - name: copy beegfs-helperd.conf
    shell: find /etc/beegfs -name "inst*" -type d -exec cp /etc/beegfs/beegfs-helperd.conf {} \;
  - name: copy beegfs-client.conf
    shell: find /etc/beegfs -name "inst*" -type d -exec cp /etc/beegfs/beegfs-client.conf {} \;
  - name: copy beegfs-mounts.conf
    shell: find /etc/beegfs -name "inst*" -type d -exec cp /etc/beegfs/beegfs-mounts.conf {} \;
 
  - name: change helperd port inst1
    lineinfile: >-
     dest='/etc/beegfs/inst1.d/beegfs-helperd.conf'
     regexp="{{ item.regexp } }"
     line="{{ item.line } }"
    with_items:
     - regexp: '^connHelperdPortTCP'
       line: 'connHelperdPortTCP = 18006'
     - regexp: '^logStdFile'
       line: 'logStdFile = /var/log/beegfs-client1.log'
  - name: change helperd port inst2
    lineinfile: >-
     dest='/etc/beegfs/inst2.d/beegfs-helperd.conf'
     regexp="{{ item.regexp } }"
     line="{{ item.line } }"
    with_items:
     - regexp: '^connHelperdPortTCP'
       line: 'connHelperdPortTCP = 28006'
     - regexp: '^logStdFile'
       line: 'logStdFile = /var/log/beegfs-client2.log'
  - name: change client port inst1
    lineinfile: >-
     dest='/etc/beegfs/inst1.d/beegfs-client.conf'
     regexp="{{ item.regexp } }"
     line="{{ item.line } }"
    with_items:
     - regexp: '^connClientPortUDP'
       line: 'connClientPortUDP = 18004'
     - regexp: '^connHelperdPortTCP'
       line: 'connHelperdPortTCP = 18006'
     - regexp: '^connMgmtdPortTCP'
       line: 'connMgmtdPortTCP = 18008'
     - regexp: '^connMgmtdPortUDP'
       line: 'connMgmtdPortUDP = 18008'
     - regexp: '^sysXAttrsEnabled'
       line: 'sysXAttrsEnabled = true'
     - regexp: '^sysACLsEnabled'
       line: 'sysACLsEnabled = true'
  - name: change client port inst2
    lineinfile: >-
     dest='/etc/beegfs/inst2.d/beegfs-client.conf'
     regexp="{{ item.regexp } }"
     line="{{ item.line } }"
    with_items:
     - regexp: '^connClientPortUDP'
       line: 'connClientPortUDP = 28004'
     - regexp: '^connHelperdPortTCP'
       line: 'connHelperdPortTCP = 28006'
     - regexp: '^connMgmtdPortTCP'
       line: 'connMgmtdPortTCP = 28008'
     - regexp: '^connMgmtdPortUDP'
       line: 'connMgmtdPortUDP = 28008'
     - regexp: '^sysXAttrsEnabled'
       line: 'sysXAttrsEnabled = true'
     - regexp: '^sysACLsEnabled'
       line: 'sysACLsEnabled = true'
  - name: change inst1 mount point
    copy:
     dest: '/etc/beegfs/inst1.d/beegfs-mounts.conf'
     content: |
       /home /etc/beegfs/inst1.d/beegfs-client.conf
  - name: change inst2 mount point
    copy:
     dest: '/etc/beegfs/inst2.d/beegfs-mounts.conf'
     content: |
       /data /etc/beegfs/inst2.d/beegfs-client.conf
  - name: copy beegfs-client@ daemon
    copy:
     src: '/usr/lib/systemd/system/beegfs-client.service'
     dest: '/usr/lib/systemd/system/beegfs-client@.service'
     remote_src: yes
  - name: change client@
    lineinfile: >-
     dest='/usr/lib/systemd/system/beegfs-client@.service'
     regexp="{{ item.regexp } }"
     line="{{ item.line } }"
    with_items:
     - regexp: '^ExecStart'
       line: 'ExecStart=/etc/init.d/beegfs-client start %I'
     - regexp: '^ExecStop'
       line: 'ExecStop=/etc/init.d/beegfs-client stop %I'
  - name: beegfs-client.service reload
    systemd:
      daemon_reload: yes
  - name: helperd MULTI_MODE
    replace: >-
     dest='/etc/default/beegfs-helperd'
     regexp='MULTI_MODE="NO"'
     replace='MULTI_MODE="YES"'
  - name: client MULTI_MODE
    replace: >-
     dest='/etc/default/beegfs-client'
     regexp='MULTI_MODE="NO"'
     replace='MULTI_MODE="YES"'
  - name: start beegfs-client
    systemd:
     name: "{{ item } }"
     enabled: yes
    with_items:
     - 'beegfs-client@inst1'
     - 'beegfs-client@inst2'
     - 'beegfs-helperd@inst1'
     - 'beegfs-helperd@inst2'

トップ   編集 添付 複製 名前変更     ヘルプ   最終更新のRSS
Last-modified: 2019-04-29 (月) 14:02:55 (225d)