Browse Source

Use test_become flag in Tobiko ansible roles

Change-Id: Ic8b6895b0bdab441b6aec0a6c8007252bfaaa5f0
changes/03/721603/4
Federico Ressi 1 year ago
parent
commit
3aa27f1beb
  1. 3
      roles/tobiko-bindep/meta/main.yaml
  2. 2
      roles/tobiko-bindep/tasks/main.yaml
  3. 4
      roles/tobiko-ensure-git/meta/main.yaml
  4. 7
      roles/tobiko-ensure-git/tasks/git.yaml
  5. 2
      roles/tobiko-ensure-python3/tasks/install.yaml
  6. 2
      roles/tobiko-ensure-python3/tasks/python3.yaml
  7. 4
      roles/tobiko-ensure-rsync/meta/main.yaml
  8. 5
      roles/tobiko-ensure-rsync/tasks/rsync.yaml
  9. 4
      roles/tobiko-inventory/tasks/main.yaml

3
roles/tobiko-bindep/meta/main.yaml

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

2
roles/tobiko-bindep/tasks/main.yaml

@ -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

4
roles/tobiko-ensure-git/meta/main.yaml

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

7
roles/tobiko-ensure-git/tasks/git.yaml

@ -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

2
roles/tobiko-ensure-python3/tasks/install.yaml

@ -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'

2
roles/tobiko-ensure-python3/tasks/python3.yaml

@ -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'

4
roles/tobiko-ensure-rsync/meta/main.yaml

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

5
roles/tobiko-ensure-rsync/tasks/rsync.yaml

@ -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

4
roles/tobiko-inventory/tasks/main.yaml

@ -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"

Loading…
Cancel
Save