Fix role gate tests for Ansible 2.3

Add 'become' and root 'user' options to the playbook instead of using
'ansible_become' through an inventory variable.

Change-Id: Ifc29eba5fe3de8b29a322a35501919074e948be9
This commit is contained in:
Jesse Pretorius 2017-05-03 14:19:08 +01:00
parent 082b0f80a7
commit cb8eae6e54
2 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,5 @@
[all] [all]
localhost ansible_host=127.0.0.1 ansible_become=True localhost
test1 ansible_host=127.111.111.101 ansible_become=True test1 ansible_host=127.111.111.101 ansible_become=True
test2 ansible_host=127.111.111.102 ansible_become=True test2 ansible_host=127.111.111.102 ansible_become=True
test3 ansible_host=127.111.111.103 ansible_become=True test3 ansible_host=127.111.111.103 ansible_become=True

View File

@ -13,11 +13,13 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# Add some data to use for verification later
- name: Playbook for test setup - name: Playbook for test setup
hosts: localhost hosts: localhost
connection: local connection: local
become: true
gather_facts: false gather_facts: false
tasks: pre_tasks:
- name: Add entries to hosts file - name: Add entries to hosts file
blockinfile: blockinfile:
dest: /etc/hosts dest: /etc/hosts
@ -27,11 +29,15 @@
127.111.111.103 test3.additional 127.111.111.103 test3.additional
marker: "" marker: ""
- include: "common/test-install-openstack-hosts.yml" # Prepare the user ssh keys
- include: common/test-prepare-keys.yml
# Execute the role
- include: common/test-install-openstack-hosts.yml
- name: Playbook for role testing - name: Playbook for role testing
hosts: localhost hosts: localhost
connection: local become: true
gather_facts: true gather_facts: true
tasks: tasks:
- name: Open modules file - name: Open modules file