Migrate playbooks to use 'become'

Ansible is scheduled to remove the 'sudo' module
and replace it with 'become'. Switch to using this
now since it is already supported in 1.9.

Closes-Bug: #1504535

Change-Id: Ie63816e36a95c86d54fea5f50325522b41597047
This commit is contained in:
stephane 2015-10-14 10:58:31 -07:00
parent a693f674f2
commit 1920428599
23 changed files with 35 additions and 35 deletions

View File

@ -2,7 +2,7 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Remove the master_images folder and deployment kernel/ramdisk for clean redeployments when testing." name: "Remove the master_images folder and deployment kernel/ramdisk for clean redeployments when testing."
sudo: yes become: yes
gather_facts: yes gather_facts: yes
tasks: tasks:
- file: path=/tftpboot/master_images state=absent - file: path=/tftpboot/master_images state=absent

View File

@ -2,11 +2,11 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Collect facts" name: "Collect facts"
sudo: no become: no
gather_facts: yes gather_facts: yes
- hosts: baremetal - hosts: baremetal
name: "Create configuration drive files and deploy machines from inventory" name: "Create configuration drive files and deploy machines from inventory"
sudo: no become: no
connection: local connection: local
roles: roles:
- role: bifrost-configdrives-dynamic - role: bifrost-configdrives-dynamic

View File

@ -2,7 +2,7 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Provide deprecation notice" name: "Provide deprecation notice"
sudo: no become: no
gather_facts: no gather_facts: no
pre_tasks: pre_tasks:
- name: "Error" - name: "Error"

View File

@ -2,11 +2,11 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Collect facts" name: "Collect facts"
sudo: no become: no
gather_facts: yes gather_facts: yes
- hosts: baremetal - hosts: baremetal
connection: local connection: local
name: "Enroll hardware from inventory into Ironic" name: "Enroll hardware from inventory into Ironic"
sudo: no become: no
roles: roles:
- role: ironic-enroll-dynamic - role: ironic-enroll-dynamic

View File

@ -2,7 +2,7 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Provide deprecation notice" name: "Provide deprecation notice"
sudo: no become: no
gather_facts: no gather_facts: no
pre_tasks: pre_tasks:
- name: "Error" - name: "Error"

View File

@ -19,11 +19,11 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Collect facts" name: "Collect facts"
sudo: no become: no
gather_facts: yes gather_facts: yes
- hosts: baremetal - hosts: baremetal
name: "Create configuration drive files and deploy machines from inventory" name: "Create configuration drive files and deploy machines from inventory"
sudo: no become: no
connection: local connection: local
roles: roles:
- { role: bifrost-configdrives-dynamic, when: provision_state == "available" and maintenance | bool != true } - { role: bifrost-configdrives-dynamic, when: provision_state == "available" and maintenance | bool != true }

View File

@ -2,7 +2,7 @@
- hosts: localhost - hosts: localhost
name: "Install Ironic on the local host." name: "Install Ironic on the local host."
connection: local connection: local
sudo: yes become: yes
gather_facts: yes gather_facts: yes
roles: roles:
- { role: bifrost-prep-for-install, when: skip_install is not defined } - { role: bifrost-prep-for-install, when: skip_install is not defined }

View File

@ -97,7 +97,7 @@ Example Playbook
- hosts: baremetal - hosts: baremetal
connection: local connection: local
sudo: no become: no
roles: roles:
- role: bifrost-configdrives-dynamic - role: bifrost-configdrives-dynamic

View File

@ -50,14 +50,14 @@
local_action: template src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/0000 local_action: template src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/0000
when: write_interfaces_file | bool when: write_interfaces_file | bool
- name: "Make config drive files" - name: "Make config drive files"
sudo: yes become: yes
local_action: command mkisofs -R -V config-2 -o {{http_boot_folder}}/configdrive-{{ uuid }}.iso {{ variable_configdrive_location.stdout }}/{{ uuid }} local_action: command mkisofs -R -V config-2 -o {{http_boot_folder}}/configdrive-{{ uuid }}.iso {{ variable_configdrive_location.stdout }}/{{ uuid }}
- name: "Make config drive files base64 encoded and gzip compressed" - name: "Make config drive files base64 encoded and gzip compressed"
sudo: yes become: yes
local_action: shell gzip -c {{http_boot_folder}}/configdrive-{{ uuid }}.iso | base64 > {{http_boot_folder}}/configdrive-{{ uuid }}.iso.gz local_action: shell gzip -c {{http_boot_folder}}/configdrive-{{ uuid }}.iso | base64 > {{http_boot_folder}}/configdrive-{{ uuid }}.iso.gz
- name: "Cleanup configdrive .iso files" - name: "Cleanup configdrive .iso files"
sudo: yes become: yes
local_action: file state=absent name={{http_boot_folder}}/configdrive-{{ uuid }}.iso local_action: file state=absent name={{http_boot_folder}}/configdrive-{{ uuid }}.iso
- name: "Cleanup configdrive temp folder" - name: "Cleanup configdrive temp folder"
sudo: yes become: yes
local_action: file state=absent force=yes name={{ variable_configdrive_location.stdout }} local_action: file state=absent force=yes name={{ variable_configdrive_location.stdout }}

View File

@ -35,7 +35,7 @@ Example Playbook
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Create bootable image" name: "Create bootable image"
sudo: yes become: yes
gather_facts: yes gather_facts: yes
roles: roles:
- role: bifrost-create-bootable-image - role: bifrost-create-bootable-image

View File

@ -84,7 +84,7 @@ Example Playbook
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Build DIB image" name: "Build DIB image"
sudo: yes become: yes
gather_facts: yes gather_facts: yes
roles: roles:
- role: bifrost-create-dib-image - role: bifrost-create-dib-image

View File

@ -34,7 +34,7 @@ Example Playbook
- hosts: localhost - hosts: localhost
connection: local connection: local
sudo: yes become: yes
gather_facts: yes gather_facts: yes
roles: roles:
- role: bifrost-create-vm-nodes - role: bifrost-create-vm-nodes

View File

@ -71,7 +71,7 @@ NOTE: The example below assumes bifrost's default and that an instance_info
- hosts: baremetal - hosts: baremetal
connection: local connection: local
sudo: no become: no
roles: roles:
- role: bifrost-configdrives - role: bifrost-configdrives
- role: bifrost-deploy-nodes-dynamic - role: bifrost-deploy-nodes-dynamic

View File

@ -136,7 +136,7 @@ Example Playbook
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Install ironic locally" name: "Install ironic locally"
sudo: yes become: yes
gather_facts: yes gather_facts: yes
roles: roles:
- role: bifrost-ironic-install - role: bifrost-ironic-install

View File

@ -48,7 +48,7 @@ of the logic to properly handle an OpenStack CI environment node.
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Prepare for installation" name: "Prepare for installation"
sudo: no become: no
gather_facts: yes gather_facts: yes
pre_tasks: pre_tasks:
- name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI" - name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI"

View File

@ -65,7 +65,7 @@ Example Playbook
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Install Ironic" name: "Install Ironic"
sudo: yes become: yes
gather_facts: yes gather_facts: yes
roles: roles:
- { role: bifrost-prep-for-install, when: skip_install is not defined } - { role: bifrost-prep-for-install, when: skip_install is not defined }

View File

@ -35,7 +35,7 @@ Example Playbook
- hosts: baremetal - hosts: baremetal
connection: local connection: local
name: "Adds and removes a .ssh/known_hosts entry" name: "Adds and removes a .ssh/known_hosts entry"
sudo: no become: no
gather_facts: no gather_facts: no
roles: roles:
- role: bifrost-prepare-for-test-dynamic - role: bifrost-prepare-for-test-dynamic

View File

@ -25,7 +25,7 @@ Example Playbook
hosts: testvm hosts: testvm
name: "Tests connectivity to the VM" name: "Tests connectivity to the VM"
sudo: no become: no
gather_facts: yes gather_facts: yes
remote_user: root remote_user: root
roles: roles:

View File

@ -31,7 +31,7 @@ Example Playbook
- hosts: baremetal - hosts: baremetal
connection: local connection: local
name: "Unprovisions the test node" name: "Unprovisions the test node"
sudo: no become: no
gather_facts: no gather_facts: no
roles: roles:
- role: bifrost-unprovision-node-dynamic - role: bifrost-unprovision-node-dynamic

View File

@ -36,7 +36,7 @@ Example Playbook
- hosts: baremetal - hosts: baremetal
connection: local connection: local
name: "Delete the node" name: "Delete the node"
sudo: no become: no
gather_facts: no gather_facts: no
roles: roles:
- role: ironic-delete-dynamic - role: ironic-delete-dynamic

View File

@ -3,7 +3,7 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Executes install, enrollment, and testing in one playbook" name: "Executes install, enrollment, and testing in one playbook"
sudo: yes become: yes
gather_facts: yes gather_facts: yes
pre_tasks: pre_tasks:
- name: "Set default baremetal.csv file if not already defined" - name: "Set default baremetal.csv file if not already defined"

View File

@ -9,7 +9,7 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Executes install, enrollment, and testing in one playbook" name: "Executes install, enrollment, and testing in one playbook"
sudo: no become: no
gather_facts: yes gather_facts: yes
pre_tasks: pre_tasks:
- name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI" - name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI"
@ -40,7 +40,7 @@
- hosts: localhost - hosts: localhost
connection: local connection: local
name: "Executes install, enrollment, and testing in one playbook" name: "Executes install, enrollment, and testing in one playbook"
sudo: yes become: yes
gather_facts: yes gather_facts: yes
pre_tasks: pre_tasks:
- name: "Collect process list if running in a CI System" - name: "Collect process list if running in a CI System"
@ -64,13 +64,13 @@
https_proxy: "{{ lookup('env','https_proxy') }}" https_proxy: "{{ lookup('env','https_proxy') }}"
- hosts: baremetal - hosts: baremetal
name: "Enroll node with Ironic" name: "Enroll node with Ironic"
sudo: no become: no
connection: local connection: local
roles: roles:
- role: ironic-enroll-dynamic - role: ironic-enroll-dynamic
- hosts: baremetal - hosts: baremetal
name: "Creat configuration drive files and deploy machines." name: "Creat configuration drive files and deploy machines."
sudo: no become: no
connection: local connection: local
roles: roles:
- role: bifrost-configdrives-dynamic - role: bifrost-configdrives-dynamic
@ -80,7 +80,7 @@
# on the contents of the CSV file. # on the contents of the CSV file.
- hosts: test - hosts: test
name: "Tests connectivity to the VM" name: "Tests connectivity to the VM"
sudo: no become: no
gather_facts: no gather_facts: no
remote_user: "{{ testing_user }}" remote_user: "{{ testing_user }}"
roles: roles:
@ -88,7 +88,7 @@
- hosts: baremetal - hosts: baremetal
connection: local connection: local
name: "Unprovisions the test node" name: "Unprovisions the test node"
sudo: no become: no
gather_facts: no gather_facts: no
roles: roles:
- role: bifrost-unprovision-node-dynamic - role: bifrost-unprovision-node-dynamic

View File

@ -3,7 +3,7 @@
# #
# #
- hosts: bifrost - hosts: bifrost
sudo: yes become: yes
tasks: tasks:
############################################################################ ############################################################################
# Install some reqired bits into the vm # Install some reqired bits into the vm
@ -56,7 +56,7 @@
removes=/var/run/reboot-required removes=/var/run/reboot-required
register: rebooted register: rebooted
- name: Wait for VM Reboot. - name: Wait for VM Reboot.
sudo: no become: no
local_action: wait_for local_action: wait_for
port=22 port=22
host="{{guest_ip.stdout}}" host="{{guest_ip.stdout}}"