diff options
Diffstat (limited to 'deploy/adapters/ansible/roles/swift/tasks')
5 files changed, 0 insertions, 288 deletions
diff --git a/deploy/adapters/ansible/roles/swift/tasks/main.yml b/deploy/adapters/ansible/roles/swift/tasks/main.yml deleted file mode 100644 index 0f083146..00000000 --- a/deploy/adapters/ansible/roles/swift/tasks/main.yml +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- include: swift.yml - when: moon == "Enable" diff --git a/deploy/adapters/ansible/roles/swift/tasks/swift-compute1.yml b/deploy/adapters/ansible/roles/swift/tasks/swift-compute1.yml deleted file mode 100644 index f4f4f7b9..00000000 --- a/deploy/adapters/ansible/roles/swift/tasks/swift-compute1.yml +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: disable auto start - copy: - content: "#!/bin/sh\nexit 101" - dest: "/usr/sbin/policy-rc.d" - mode: 0755 - when: ansible_os_family == "Debian" - -- name: install swift-compute packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: compute_packages | union(compute_packages_noarch) - -- name: enable auto start - file: - path=/usr/sbin/policy-rc.d - state=absent - when: ansible_os_family == "Debian" - -- name: format devices - shell: > - dd if=/dev/zero of=/var/swift1 bs=1G count=10; - dd if=/dev/zero of=/var/swift2 bs=1G count=10; - mkfs.xfs /var/swift1; - mkfs.xfs /var/swift2; - -- name: create mount point dirertory - shell: > - mkdir -p /srv/node/swift1; - mkdir -p /srv/node/swift2; - -- name: edit /etc/fstab - shell: > - echo "/var/swift1 /srv/node/swift1/ xfs noatime,nodiratime,nobarrier,logbufs=8 0 2" \ - >> /etc/fstab; - echo "/var/swift2 /srv/node/swift2/ xfs noatime,nodiratime,nobarrier,logbufs=8 0 2" \ - >> /etc/fstab; - mount /srv/node/swift1; - mount /srv/node/swift2; - -- name: edit /etc/default/rsync - shell: sed -i 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/g' /etc/default/rsync - -- name: restart rsync service - service: name=rsync state=restarted enabled=yes - -- name: copy scripts - template: src={{ item }} dest=/etc/swift/ backup=yes - with_items: - - account-server.conf - - container-server.conf - - object-server.conf - -- name: change directory - shell: > - chown -R swift:swift /srv/node; - mkdir -p /var/cache/swift; - chown -R root:swift /var/cache/swift; - chmod -R 775 /var/cache/swift; diff --git a/deploy/adapters/ansible/roles/swift/tasks/swift-controller1.yml b/deploy/adapters/ansible/roles/swift/tasks/swift-controller1.yml deleted file mode 100644 index 7346da10..00000000 --- a/deploy/adapters/ansible/roles/swift/tasks/swift-controller1.yml +++ /dev/null @@ -1,32 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- - -- name: disable auto start - copy: - content: "#!/bin/sh\nexit 101" - dest: "/usr/sbin/policy-rc.d" - mode: 0755 - when: ansible_os_family == "Debian" - -- name: install swift-controllor packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: controller_packages | union(controller_packages_noarch) - -- name: enable auto start - file: - path=/usr/sbin/policy-rc.d - state=absent - when: ansible_os_family == "Debian" - -- name: make swift directory - file: path=/etc/swift state=directory mode=0755 - -- name: update proxy-server conf - template: src=proxy-server.conf dest=/etc/swift/proxy-server.conf backup=yes diff --git a/deploy/adapters/ansible/roles/swift/tasks/swift-controller2.yml b/deploy/adapters/ansible/roles/swift/tasks/swift-controller2.yml deleted file mode 100644 index 75e77882..00000000 --- a/deploy/adapters/ansible/roles/swift/tasks/swift-controller2.yml +++ /dev/null @@ -1,100 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: create account.builder file - shell: > - cd /etc/swift; - swift-ring-builder account.builder create 10 3 1; - -- name: add each storage node to the ring - shell: > - cd /etc/swift; - swift-ring-builder account.builder add --region 1 --zone 1 \ - --ip {{ ip_settings[item.1]['mgmt']['ip'] }} --port 6002 \ - --device swift1 --weight 100 ; - swift-ring-builder account.builder add --region 1 --zone 1 \ - --ip {{ ip_settings[item.1]['mgmt']['ip'] }} --port 6002 \ - --device swift2 --weight 100 ; - with_indexed_items: groups['compute'] - -- name: verify the ring contents 1 - shell: > - cd /etc/swift; - swift-ring-builder account.builder; - -- name: rebalance the ring - shell: > - cd /etc/swift; - swift-ring-builder account.builder rebalance; - -- name: create contrainer builder file - shell: > - cd /etc/swift; - swift-ring-builder container.builder create 10 3 1; - -- name: add each storage node to the ring - shell: > - cd /etc/swift; - swift-ring-builder container.builder add --region 1 --zone 1 \ - --ip {{ ip_settings[item.1]['mgmt']['ip'] }} --port 6001 \ - --device swift1 --weight 100; - swift-ring-builder container.builder add --region 1 --zone 1 \ - --ip {{ ip_settings[item.1]['mgmt']['ip'] }} --port 6001 \ - --device swift2 --weight 100; - with_indexed_items: groups['compute'] - -- name: verify the ring contents 2 - shell: > - cd /etc/swift; - swift-ring-builder container.builder; - -- name: rebalance the ring - shell: > - cd /etc/swift; - swift-ring-builder container.builder rebalance; - -- name: create object builder file - shell: > - cd /etc/swift; - swift-ring-builder object.builder create 10 3 1; - -- name: add each storage node to the ring - shell: > - cd /etc/swift; - swift-ring-builder object.builder add --region 1 --zone 1 \ - --ip {{ ip_settings[item.1]['mgmt']['ip'] }} --port 6000 \ - --device swift1 --weight 100; - swift-ring-builder object.builder add --region 1 --zone 1 \ - --ip {{ ip_settings[item.1]['mgmt']['ip'] }} --port 6000 \ - --device swift2 --weight 100; - with_indexed_items: groups['compute'] - -- name: verify the ring contents - shell: > - cd /etc/swift; - swift-ring-builder object.builder; - -- name: rebalance the ring - shell: > - cd /etc/swift; - swift-ring-builder object.builder rebalance; - -- name: distribute ring configuration files to the other controller - shell: > - cd /etc/swift; - scp account.ring.gz container.ring.gz object.ring.gz \ - root@{{ ip_settings[item.1]['mgmt']['ip'] }}:/etc/swift/; - with_indexed_items: groups['controller'] - -- name: distribute ring configuration files to the all compute - shell: > - cd /etc/swift; - scp account.ring.gz container.ring.gz object.ring.gz \ - root@{{ ip_settings[item.1]['mgmt']['ip'] }}:/etc/swift/; - with_indexed_items: groups['compute'] diff --git a/deploy/adapters/ansible/roles/swift/tasks/swift.yml b/deploy/adapters/ansible/roles/swift/tasks/swift.yml deleted file mode 100644 index 473c2710..00000000 --- a/deploy/adapters/ansible/roles/swift/tasks/swift.yml +++ /dev/null @@ -1,79 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- include_vars: "{{ ansible_os_family }}.yml" - -- include: swift-controller1.yml - when: inventory_hostname in groups['controller'] - -- include: swift-compute1.yml - when: inventory_hostname in groups['compute'] - -- include: swift-controller2.yml - when: inventory_hostname == haproxy_hosts.keys()[0] - -- name: copy swift.conf - template: src=swift.conf dest=/etc/swift/swift.conf backup=yes - -- name: chown /etc/swift - shell: chown -R root:swift /etc/swift - -- name: restart tasks on controller - service: name={{ item }} state=restarted enabled=yes - with_items: - - memcached - - swift-proxy - when: inventory_hostname in groups['controller'] - -- name: restart tasks on compute - shell: swift-init all start - when: inventory_hostname in groups['compute'] - ignore_errors: "True" - -- name: restart tasks on controller - service: name={{ item }} state=restarted enabled=yes - with_items: - - rsync - when: inventory_hostname in groups['compute'] - -- name: upload swift lib - unarchive: src=swift-lib.tar.gz dest=/tmp/ - -- name: copy swift lib - command: su -s /bin/sh -c "cp /tmp/swift-lib/* /usr/lib/" - -- name: wait 30 seconds - shell: sleep 30 - -- name: create swift task script - shell: echo {{ item }} >> /opt/swift-service - with_items: - - swift-account - - swift-account-replicator - - swift-container-replicator - - swift-object - - swift-object-updater - - swift-account-auditor - - swift-container - - swift-container-sync - - swift-object-auditor - - swift-account-reaper - - swift-container-auditor - - swift-container-updater - - swift-object-replicator - when: inventory_hostname in groups['compute'] - ignore_errors: "True" - -- name: restart swift task - shell: > - for i in `cat /opt/swift-service`; do service $i start; done; - sleep 10; - for i in `cat /opt/swift-service`; do service $i restart; done; - when: inventory_hostname in groups['compute'] - ignore_errors: "True" |