Handle OS requirements for Ansible
This commit is contained in:
21
tasks/Debian-default.yml
Normal file
21
tasks/Debian-default.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
# tasks file for ensure_ansible_prereq
|
||||
- name: 'package states'
|
||||
package:
|
||||
name: '{{ item.name }}'
|
||||
state: '{{ item.state }}'
|
||||
loop:
|
||||
- { name: 'python-apt', state: 'present' }
|
||||
- { name: 'sudo', state: 'present' }
|
||||
loop_control:
|
||||
label: '{{ item.name }} will be {{ item.state }}'
|
||||
- name: 'service states'
|
||||
service:
|
||||
enabled: '{{ item.enabled }}'
|
||||
name: '{{ item.name }}'
|
||||
state: '{{ item.state }}'
|
||||
loop:
|
||||
- { enables: 'yes', name: 'acpid', state: 'started' }
|
||||
loop_control:
|
||||
label: '{{ item.name }} will be {{ item.state }}'
|
||||
|
20
tasks/RedHat-6-default.yml
Normal file
20
tasks/RedHat-6-default.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
# tasks file for ensure_ansible_prereq
|
||||
- name: 'package states'
|
||||
package:
|
||||
name: '{{ item.name }}'
|
||||
state: '{{ item.state }}'
|
||||
loop:
|
||||
- { name: 'acpid', state: 'present' }
|
||||
loop_control:
|
||||
label: '{{ item.name }} will be {{ item.state }}'
|
||||
- name: 'service states'
|
||||
service:
|
||||
enabled: '{{ item.enabled }}'
|
||||
name: '{{ item.name }}'
|
||||
state: '{{ item.state }}'
|
||||
loop:
|
||||
- { enables: 'yes', name: 'acpid', state: 'started' }
|
||||
loop_control:
|
||||
label: '{{ item.name }} will be {{ item.state }}'
|
||||
|
19
tasks/main.yml
Normal file
19
tasks/main.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
# tasks file for ensure_ansible_prereq
|
||||
- name: 'include variables'
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
include_tasks:
|
||||
file: '{{ lookup("first_found", findme ) }}'
|
||||
vars:
|
||||
findme:
|
||||
files:
|
||||
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml'
|
||||
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-default.yml'
|
||||
- '{{ ansible_distribution }}-default.yml'
|
||||
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}.yml'
|
||||
- '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}-default.yml'
|
||||
- '{{ ansible_os_family }}-default.yml'
|
||||
- 'default.yml'
|
||||
errors: 'ignore'
|
||||
|
Reference in New Issue
Block a user