Use test_become flag in Tobiko ansible roles

Change-Id: Ic8b6895b0bdab441b6aec0a6c8007252bfaaa5f0
This commit is contained in:
Federico Ressi 2020-04-21 14:50:16 +02:00
parent 3eadbe21f9
commit 3aa27f1beb
9 changed files with 24 additions and 9 deletions

View File

@ -1,4 +1,5 @@
---
dependencies:
- role: tobiko-ensure-python3
- tobiko-common
- tobiko-ensure-python3

View File

@ -27,7 +27,7 @@
failed_when: yes
- name: 'install missing packages'
become: yes
become: '{{ test_become | bool }}'
package:
name: '{{ run_bindep.stdout_lines }}'
register: install_packages

View File

@ -0,0 +1,4 @@
---
dependencies:
- role: tobiko-common

View File

@ -4,17 +4,19 @@
- name: "get '{{ git_executable }}' full path"
shell: >
which '{{ git_executable }}'
changed_when: no
register: get_git_path
rescue:
- name: "install Git packages"
become: true
- name: "install Git package"
become: '{{ test_become | bool }}'
package:
name: git
- name: "get '{{ git_executable }}' full path"
shell: >
which '{{ git_executable }}'
changed_when: no
register: get_git_path
@ -26,6 +28,7 @@
- name: "get Git version"
command: >
'{{ git_executable }}' --version
changed_when: no
register:
get_git_version

View File

@ -1,7 +1,7 @@
---
- name: "install '{{ python_command }}' packages"
become: true
become: '{{ test_become | bool }}'
package:
name: "{{ python_packages[python_command] | flatten }}"
when: 'python_command in python_packages'

View File

@ -34,7 +34,7 @@
rescue:
- name: "try setting python alternative to '{{ python_alternative }}'"
become: true
become: '{{ test_become | bool }}'
command: "alternatives --set python '{{ python_alternative }}'"
ignore_errors: yes
when: 'python_alternative is defined'

View File

@ -0,0 +1,4 @@
---
dependencies:
- role: tobiko-common

View File

@ -4,17 +4,19 @@
- name: "get '{{ rsync_executable }}' full path"
shell: >
which '{{ rsync_executable }}'
changed_when: no
register: get_rsync_path
rescue:
- name: "install Rsync packages"
become: true
become: '{{ test_become | bool }}'
package:
name: rsync
- name: "get '{{ rsync_executable }}' full path"
shell: >
which '{{ rsync_executable }}'
changed_when: no
register: get_rsync_path
@ -26,6 +28,7 @@
- name: "get Rsync version"
command: >
'{{ rsync_executable }}' --version
changed_when: no
register:
get_rsync_version

View File

@ -17,8 +17,8 @@
block:
- name: "get remote username"
command: whoami
changed_when: false
become: false
changed_when: no
become: no
register: get_inventory_user
- name: "set test_inventory_user fact"