Skip to content

Instantly share code, notes, and snippets.

@chianingwang
Last active January 14, 2017 02:04
Show Gist options
  • Save chianingwang/ac4b277e47cf9d605d7316ded67127ef to your computer and use it in GitHub Desktop.
Save chianingwang/ac4b277e47cf9d605d7316ded67127ef to your computer and use it in GitHub Desktop.
# ./setup_and_run_ansible_on_guest.sh saio --debug
+ DEBUG=--debug
+ '[' '!' -d ./components/swift/.git ']'
+ tar cf - ./ansible
+ lxc exec saio -- tar xf - -C /root/
+ lxc exec saio -- tar xf - -C /root/
+ tar cf - -C ./components .
+ lxc exec saio -- /bin/bash /root/ansible/install_ansible.sh --debug
+ set +e
+ echo 'Waiting on networking...'
Waiting on networking...
+ for i in '{1..20}'
+ ping -c 1 archive.ubuntu.com
PING archive.ubuntu.com (91.189.88.149) 56(84) bytes of data.
64 bytes from danava.canonical.com (91.189.88.149): icmp_seq=1 ttl=46 time=140 ms
--- archive.ubuntu.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 140.900/140.900/140.900/0.000 ms
+ '[' 0 -ne 0 ']'
+ break
+ echo 'Done!'
Done!
+ distro=RHEL
++ type -P yum
+ installer=
+ '[' -z '' ']'
++ which apt-get
+ installer=/usr/bin/apt-get
+ distro=Debian
+ '[' -z /usr/bin/apt-get ']'
+ '[' Debian == RHEL ']'
+ /usr/bin/apt-get install -y ansible
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ieee-data libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-crypto python-ecdsa python-httplib2 python-jinja2 python-markupsafe python-minimal python-netaddr python-paramiko python-pkg-resources python-selinux python-six python-yaml python2.7
python2.7-minimal
Suggested packages:
sshpass python-doc python-tk python-crypto-dbg python-crypto-doc python-jinja2-doc ipython python-netaddr-docs python-setuptools python2.7-doc binutils binfmt-support
The following NEW packages will be installed:
ansible ieee-data libpython-stdlib libpython2.7-minimal libpython2.7-stdlib python python-crypto python-ecdsa python-httplib2 python-jinja2 python-markupsafe python-minimal python-netaddr python-paramiko python-pkg-resources python-selinux python-six python-yaml
python2.7 python2.7-minimal
0 upgraded, 20 newly installed, 0 to remove and 0 not upgraded.
Need to get 6878 kB of archives.
After this operation, 34.5 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-minimal amd64 2.7.12-1ubuntu0~16.04.1 [339 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7-minimal amd64 2.7.12-1ubuntu0~16.04.1 [1295 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-minimal amd64 2.7.11-1 [28.2 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpython2.7-stdlib amd64 2.7.12-1ubuntu0~16.04.1 [1884 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 python2.7 amd64 2.7.12-1ubuntu0~16.04.1 [224 kB]
Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 libpython-stdlib amd64 2.7.11-1 [7656 B]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 python amd64 2.7.11-1 [137 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-crypto amd64 2.6.1-6build1 [245 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-markupsafe amd64 0.23-2build2 [15.5 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-jinja2 all 2.8-1 [109 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-six all 1.10.0-3 [10.9 kB]
Get:12 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-ecdsa all 0.13-2 [34.0 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-paramiko all 1.16.0-1 [109 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-pkg-resources all 20.7.0-1 [108 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-yaml amd64 3.11-3build1 [105 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-httplib2 all 0.9.1+dfsg-1 [34.2 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial/main amd64 ieee-data all 20150531.1 [830 kB]
Get:18 http://archive.ubuntu.com/ubuntu xenial/main amd64 python-netaddr all 0.7.18-1 [174 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 ansible all 2.0.0.2-2ubuntu1 [1016 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python-selinux amd64 2.4-3build2 [173 kB]
Fetched 6878 kB in 16s (423 kB/s)
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 25465 files and directories currently installed.)
Preparing to unpack .../libpython2.7-minimal_2.7.12-1ubuntu0~16.04.1_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.1) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.12-1ubuntu0~16.04.1_amd64.deb ...
Unpacking python2.7-minimal (2.7.12-1ubuntu0~16.04.1) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.11-1_amd64.deb ...
Unpacking python-minimal (2.7.11-1) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../libpython2.7-stdlib_2.7.12-1ubuntu0~16.04.1_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.1) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.12-1ubuntu0~16.04.1_amd64.deb ...
Unpacking python2.7 (2.7.12-1ubuntu0~16.04.1) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.11-1_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.11-1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython2.7-minimal:amd64 (2.7.12-1ubuntu0~16.04.1) ...
Setting up python2.7-minimal (2.7.12-1ubuntu0~16.04.1) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python-minimal (2.7.11-1) ...
Selecting previously unselected package python.
(Reading database ... 26211 files and directories currently installed.)
Preparing to unpack .../python_2.7.11-1_amd64.deb ...
Unpacking python (2.7.11-1) ...
Selecting previously unselected package python-crypto.
Preparing to unpack .../python-crypto_2.6.1-6build1_amd64.deb ...
Unpacking python-crypto (2.6.1-6build1) ...
Selecting previously unselected package python-markupsafe.
Preparing to unpack .../python-markupsafe_0.23-2build2_amd64.deb ...
Unpacking python-markupsafe (0.23-2build2) ...
Selecting previously unselected package python-jinja2.
Preparing to unpack .../python-jinja2_2.8-1_all.deb ...
Unpacking python-jinja2 (2.8-1) ...
Selecting previously unselected package python-six.
Preparing to unpack .../python-six_1.10.0-3_all.deb ...
Unpacking python-six (1.10.0-3) ...
Selecting previously unselected package python-ecdsa.
Preparing to unpack .../python-ecdsa_0.13-2_all.deb ...
Unpacking python-ecdsa (0.13-2) ...
Selecting previously unselected package python-paramiko.
Preparing to unpack .../python-paramiko_1.16.0-1_all.deb ...
Unpacking python-paramiko (1.16.0-1) ...
Selecting previously unselected package python-pkg-resources.
Preparing to unpack .../python-pkg-resources_20.7.0-1_all.deb ...
Unpacking python-pkg-resources (20.7.0-1) ...
Selecting previously unselected package python-yaml.
Preparing to unpack .../python-yaml_3.11-3build1_amd64.deb ...
Unpacking python-yaml (3.11-3build1) ...
Selecting previously unselected package python-httplib2.
Preparing to unpack .../python-httplib2_0.9.1+dfsg-1_all.deb ...
Unpacking python-httplib2 (0.9.1+dfsg-1) ...
Selecting previously unselected package ieee-data.
Preparing to unpack .../ieee-data_20150531.1_all.deb ...
Unpacking ieee-data (20150531.1) ...
Selecting previously unselected package python-netaddr.
Preparing to unpack .../python-netaddr_0.7.18-1_all.deb ...
Unpacking python-netaddr (0.7.18-1) ...
Selecting previously unselected package ansible.
Preparing to unpack .../ansible_2.0.0.2-2ubuntu1_all.deb ...
Unpacking ansible (2.0.0.2-2ubuntu1) ...
Selecting previously unselected package python-selinux.
Preparing to unpack .../python-selinux_2.4-3build2_amd64.deb ...
Unpacking python-selinux (2.4-3build2) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.12-1ubuntu0~16.04.1) ...
Setting up python2.7 (2.7.12-1ubuntu0~16.04.1) ...
Setting up libpython-stdlib:amd64 (2.7.11-1) ...
Setting up python (2.7.11-1) ...
Setting up python-crypto (2.6.1-6build1) ...
Setting up python-markupsafe (0.23-2build2) ...
Setting up python-jinja2 (2.8-1) ...
Setting up python-six (1.10.0-3) ...
Setting up python-ecdsa (0.13-2) ...
Setting up python-paramiko (1.16.0-1) ...
Setting up python-pkg-resources (20.7.0-1) ...
Setting up python-yaml (3.11-3build1) ...
Setting up python-httplib2 (0.9.1+dfsg-1) ...
Setting up ieee-data (20150531.1) ...
Setting up python-netaddr (0.7.18-1) ...
Setting up ansible (2.0.0.2-2ubuntu1) ...
Setting up python-selinux (2.4-3build2) ...
+ lxc exec saio -- ansible-playbook -i localhost, -c local /root/ansible/master_playbook.yaml
PLAY [The whole shebang] *******************************************************
TASK [setup] *******************************************************************
ok: [localhost]
TASK [include] *****************************************************************
included: /root/ansible/tasks/main.yaml for localhost
TASK [Create swift group] ******************************************************
changed: [localhost]
TASK [Create swift user] *******************************************************
changed: [localhost]
TASK [Create etc swift] ********************************************************
changed: [localhost]
TASK [Create swift config files] ***********************************************
changed: [localhost]
TASK [list of the .conf files and store it in register] ************************
ok: [localhost]
TASK [Set swift user in configs] ***********************************************
changed: [localhost] => (item=/etc/swift/container-reconciler.conf)
ok: [localhost] => (item=/etc/swift/container-sync-realms.conf)
changed: [localhost] => (item=/etc/swift/object-server/1.conf)
changed: [localhost] => (item=/etc/swift/object-server/4.conf)
changed: [localhost] => (item=/etc/swift/object-server/2.conf)
changed: [localhost] => (item=/etc/swift/object-server/3.conf)
changed: [localhost] => (item=/etc/swift/proxy-server.conf)
changed: [localhost] => (item=/etc/swift/account-server/4.conf)
changed: [localhost] => (item=/etc/swift/account-server/1.conf)
changed: [localhost] => (item=/etc/swift/account-server/3.conf)
changed: [localhost] => (item=/etc/swift/account-server/2.conf)
changed: [localhost] => (item=/etc/swift/object-expirer.conf)
changed: [localhost] => (item=/etc/swift/container-server/4.conf)
changed: [localhost] => (item=/etc/swift/container-server/1.conf)
changed: [localhost] => (item=/etc/swift/container-server/3.conf)
changed: [localhost] => (item=/etc/swift/container-server/2.conf)
ok: [localhost] => (item=/etc/swift/swift.conf)
TASK [Make filesystems on disks] ***********************************************
changed: [localhost] => (item=zd80)
changed: [localhost] => (item=zd96)
changed: [localhost] => (item=zd112)
changed: [localhost] => (item=zd128)
changed: [localhost] => (item=zd144)
changed: [localhost] => (item=zd160)
changed: [localhost] => (item=zd176)
changed: [localhost] => (item=zd192)
TASK [Mount disks] *************************************************************
changed: [localhost] => (item={u'drive': u'zd80', u'mp': u'/srv/1/node/d1'})
changed: [localhost] => (item={u'drive': u'zd96', u'mp': u'/srv/2/node/d2'})
changed: [localhost] => (item={u'drive': u'zd112', u'mp': u'/srv/3/node/d3'})
changed: [localhost] => (item={u'drive': u'zd128', u'mp': u'/srv/4/node/d4'})
changed: [localhost] => (item={u'drive': u'zd144', u'mp': u'/srv/1/node/d5'})
changed: [localhost] => (item={u'drive': u'zd160', u'mp': u'/srv/2/node/d6'})
changed: [localhost] => (item={u'drive': u'zd176', u'mp': u'/srv/3/node/d7'})
changed: [localhost] => (item={u'drive': u'zd192', u'mp': u'/srv/4/node/d8'})
TASK [Set permissions] *********************************************************
changed: [localhost] => (item=/srv/1)
changed: [localhost] => (item=/srv/2)
changed: [localhost] => (item=/srv/3)
changed: [localhost] => (item=/srv/4)
TASK [Set up rsync] ************************************************************
changed: [localhost]
TASK [install dependencies] ****************************************************
changed: [localhost] => (item=[u'curl', u'gcc', u'memcached', u'sqlite3', u'libffi-dev', u'python-setuptools', u'liberasurecode-dev', u'libssl-dev', u'python-coverage', u'python-dev', u'python-nose', u'python-xattr', u'python-eventlet', u'python-greenlet', u'python-pastedeploy', u'python-netifaces', u'python-pip', u'python-dnspython', u'python-mock'])
TASK [Install swift] ***********************************************************
changed: [localhost]
TASK [Build rings] *************************************************************
changed: [localhost]
TASK [Start swift] *************************************************************
changed: [localhost]
PLAY RECAP *********************************************************************
localhost : ok=16 changed=13 unreachable=0 failed=0
root@saio:~# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat
Account: AUTH_test
Containers: 0
Objects: 0
Bytes: 0
X-Put-Timestamp: 1484359227.95780
X-Timestamp: 1484359227.95780
X-Trans-Id: tx40ba14c69b604c79bf074-005879863b
Content-Type: text/plain; charset=utf-8
X-Openstack-Request-Id: tx40ba14c69b604c79bf074-005879863b
root@saio:~# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing post test_container
root@saio:~# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing list
test_container
root@saio:~# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing upload test_container README
README
root@saio:~# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing list
test_container
root@saio:~# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing list test_container
README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment