mirror of
https://github.com/geerlingguy/ansible-role-ansible.git
synced 2024-11-22 11:35:11 +01:00
Issue #7: Better package management setup.
This commit is contained in:
parent
c17bf5e903
commit
33a2d8ded7
12
molecule/default/playbook-pip.yml
Normal file
12
molecule/default/playbook-pip.yml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
|
||||
vars:
|
||||
ansible_install_method: pip
|
||||
ansible_install_version_pip: "2.6.2"
|
||||
|
||||
roles:
|
||||
- role: geerlingguy.pip
|
||||
- role: geerlingguy.ansible
|
2
molecule/default/requirements.yml
Normal file
2
molecule/default/requirements.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
- role: geerlingguy.pip
|
@ -1,26 +1,27 @@
|
||||
---
|
||||
- name: Set the package state based on how Ansible is installed.
|
||||
set_fact:
|
||||
ansible_package_state: "{{ 'present' if ansible_install_method == 'package' else 'absent' }}"
|
||||
|
||||
# Setup/install tasks.
|
||||
- include_tasks: setup-RedHat.yml
|
||||
- name: Set up Ansible on RedHat.
|
||||
include_tasks: setup-RedHat.yml
|
||||
when:
|
||||
- ansible_install_method == 'package'
|
||||
- ansible_os_family == 'RedHat'
|
||||
- ansible_distribution != 'Fedora'
|
||||
|
||||
- include_tasks: setup-Fedora.yml
|
||||
when:
|
||||
- ansible_install_method == 'package'
|
||||
- ansible_distribution == 'Fedora'
|
||||
- name: Set up Ansible on Fedora.
|
||||
include_tasks: setup-Fedora.yml
|
||||
when: ansible_distribution == 'Fedora'
|
||||
|
||||
- include_tasks: setup-Ubuntu.yml
|
||||
when:
|
||||
- ansible_install_method == 'package'
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
- name: Set up Ansible on Ubuntu.
|
||||
include_tasks: setup-Ubuntu.yml
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
- include_tasks: setup-Debian.yml
|
||||
when:
|
||||
- ansible_install_method == 'package'
|
||||
- ansible_distribution == 'Debian'
|
||||
- name: Set up Ansible on Debian.
|
||||
include_tasks: setup-Debian.yml
|
||||
when: ansible_distribution == 'Debian'
|
||||
|
||||
- include_tasks: setup-pip.yml
|
||||
when:
|
||||
- ansible_install_method == 'pip'
|
||||
- name: Set up Ansible using Pip.
|
||||
include_tasks: setup-pip.yml
|
||||
when: ansible_install_method == 'pip'
|
||||
|
@ -9,7 +9,7 @@
|
||||
when: ansible_distribution_version < 9
|
||||
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=86400
|
||||
apt: update_cache=true cache_valid_time=86400
|
||||
|
||||
- name: Set the default_release option for older Debian versions.
|
||||
set_fact:
|
||||
@ -19,5 +19,5 @@
|
||||
- name: Install Ansible.
|
||||
apt:
|
||||
name: ansible
|
||||
state: present
|
||||
state: "{{ ansible_package_state }}"
|
||||
default_release: "{{ ansible_default_release }}"
|
||||
|
@ -1,3 +1,5 @@
|
||||
---
|
||||
- name: Install Ansible.
|
||||
package: name=ansible state=present
|
||||
package:
|
||||
name: ansible
|
||||
state: "{{ ansible_package_state }}"
|
||||
|
@ -1,3 +1,6 @@
|
||||
---
|
||||
- name: Install Ansible.
|
||||
yum: name=ansible state=present enablerepo=epel
|
||||
yum:
|
||||
name: ansible
|
||||
state: "{{ ansible_package_state }}"
|
||||
enablerepo: epel
|
||||
|
@ -3,7 +3,9 @@
|
||||
apt_repository: repo='ppa:ansible/ansible'
|
||||
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=86400
|
||||
apt: update_cache=true cache_valid_time=86400
|
||||
|
||||
- name: Install Ansible.
|
||||
apt: name=ansible state=present
|
||||
apt:
|
||||
name: ansible
|
||||
state: "{{ ansible_package_state }}"
|
||||
|
5
tasks/setup-pip.yml
Normal file
5
tasks/setup-pip.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Install Ansible via Pip.
|
||||
pip:
|
||||
name: ansible
|
||||
version: "{{ ansible_install_version_pip | default(omit) }}"
|
Loading…
Reference in New Issue
Block a user