Compare commits
27 Commits
Author | SHA1 | Date |
---|---|---|
Jeff Geerling | 8c85339f21 | |
Jeff Geerling | 470ad53d13 | |
Jeff Geerling | e9a19b1a79 | |
Jeff Geerling | e33397b43a | |
Jeff Geerling | b1d2710661 | |
Jeff Geerling | 8a145319a3 | |
Steve Jorgensen | ac2fc8372c | |
Jeff Geerling | e01427a892 | |
Morgan Lindqvist | e96ad2577f | |
Jeff Geerling | 4ac86968ff | |
Jeff Geerling | d9d3fe3f39 | |
Jeff Geerling | ebb6b438ab | |
Jeff Geerling | 4682745d1b | |
Jeff Geerling | e621f3b2f7 | |
Jeff Geerling | 875a8f93b2 | |
Jeff Geerling | 53b364606d | |
Jeff Geerling | 25d8f5fc04 | |
Jeff Geerling | 94b3532fb4 | |
Jeff Geerling | adf22d8c73 | |
Jeff Geerling | 35546b1505 | |
Jeff Geerling | ba22aaeb41 | |
Jeff Geerling | 409ec4b75a | |
Jeff Geerling | d600480d49 | |
Jeff Geerling | 214fe648a4 | |
Jeff Geerling | 25a7bf99f4 | |
Jeff Geerling | cc3093948d | |
Jeff Geerling | b063494796 |
|
@ -0,0 +1,3 @@
|
|||
skip_list:
|
||||
- 'yaml'
|
||||
- 'role-name'
|
|
@ -0,0 +1,75 @@
|
|||
---
|
||||
name: CI
|
||||
'on':
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
- cron: "30 5 * * 0"
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: 'geerlingguy.ansible'
|
||||
|
||||
jobs:
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the codebase.
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'geerlingguy.ansible'
|
||||
|
||||
- name: Set up Python 3.
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install test dependencies.
|
||||
run: pip3 install yamllint
|
||||
|
||||
- name: Lint code.
|
||||
run: |
|
||||
yamllint .
|
||||
|
||||
molecule:
|
||||
name: Molecule
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- distro: rockylinux9
|
||||
playbook: converge.yml
|
||||
- distro: fedora39
|
||||
playbook: converge.yml
|
||||
- distro: ubuntu2204
|
||||
playbook: converge.yml
|
||||
- distro: debian12
|
||||
playbook: converge.yml
|
||||
- distro: rockylinux8
|
||||
playbook: pip.yml
|
||||
|
||||
steps:
|
||||
- name: Check out the codebase.
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'geerlingguy.ansible'
|
||||
|
||||
- name: Set up Python 3.
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install test dependencies.
|
||||
run: pip3 install ansible molecule molecule-plugins[docker] docker
|
||||
|
||||
- name: Run Molecule tests.
|
||||
run: molecule test
|
||||
env:
|
||||
PY_COLORS: '1'
|
||||
ANSIBLE_FORCE_COLOR: '1'
|
||||
MOLECULE_DISTRO: ${{ matrix.distro }}
|
||||
MOLECULE_PLAYBOOK: ${{ matrix.playbook }}
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
# This workflow requires a GALAXY_API_KEY secret present in the GitHub
|
||||
# repository or organization.
|
||||
#
|
||||
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
|
||||
# See: https://github.com/ansible/galaxy/issues/46
|
||||
|
||||
name: Release
|
||||
'on':
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: 'geerlingguy.ansible'
|
||||
|
||||
jobs:
|
||||
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the codebase.
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'geerlingguy.ansible'
|
||||
|
||||
- name: Set up Python 3.
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install Ansible.
|
||||
run: pip3 install ansible-core
|
||||
|
||||
- name: Trigger a new import on Galaxy.
|
||||
run: >-
|
||||
ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }}
|
||||
$(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
name: Close inactive issues
|
||||
'on':
|
||||
schedule:
|
||||
- cron: "55 19 * * 1" # semi-random time
|
||||
|
||||
jobs:
|
||||
close-issues:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v8
|
||||
with:
|
||||
days-before-stale: 120
|
||||
days-before-close: 60
|
||||
exempt-issue-labels: bug,pinned,security,planned
|
||||
exempt-pr-labels: bug,pinned,security,planned
|
||||
stale-issue-label: "stale"
|
||||
stale-pr-label: "stale"
|
||||
stale-issue-message: |
|
||||
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
|
||||
|
||||
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
|
||||
close-issue-message: |
|
||||
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
||||
stale-pr-message: |
|
||||
This pr has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
|
||||
|
||||
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
|
||||
close-pr-message: |
|
||||
This pr has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -1,3 +1,5 @@
|
|||
*.retry
|
||||
*/__pycache__
|
||||
*.pyc
|
||||
.cache
|
||||
|
||||
|
|
32
.travis.yml
32
.travis.yml
|
@ -1,32 +0,0 @@
|
|||
---
|
||||
language: python
|
||||
services: docker
|
||||
|
||||
env:
|
||||
global:
|
||||
- ROLE_NAME: ansible
|
||||
matrix:
|
||||
- MOLECULE_DISTRO: centos7
|
||||
- MOLECULE_DISTRO: fedora29
|
||||
- MOLECULE_DISTRO: ubuntu1804
|
||||
- MOLECULE_DISTRO: debian9
|
||||
|
||||
- MOLECULE_DISTRO: centos7
|
||||
MOLECULE_PLAYBOOK: playbook-pip.yml
|
||||
|
||||
install:
|
||||
# Install test dependencies.
|
||||
- pip install molecule yamllint ansible-lint docker
|
||||
|
||||
before_script:
|
||||
# Use actual Ansible Galaxy role name for the project directory.
|
||||
- cd ../
|
||||
- mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME
|
||||
- cd geerlingguy.$ROLE_NAME
|
||||
|
||||
script:
|
||||
# Run tests.
|
||||
- molecule test
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
|
@ -1,6 +1,10 @@
|
|||
---
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
max: 120
|
||||
level: warning
|
||||
|
||||
ignore: |
|
||||
.github/workflows/stale.yml
|
||||
|
|
18
README.md
18
README.md
|
@ -1,12 +1,12 @@
|
|||
# Ansible Role: Ansible
|
||||
|
||||
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-ansible.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-ansible)
|
||||
[![CI](https://github.com/geerlingguy/ansible-role-ansible/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-ansible/actions?query=workflow%3ACI)
|
||||
|
||||
An Ansible Role that installs Ansible on Linux servers.
|
||||
|
||||
## Requirements
|
||||
|
||||
If using on a RedHat/CentOS-based host, make sure you've added the EPEL repository (it can easily be installed by including the `geerlingguy.repo-epel` role on Ansible Galaxy).
|
||||
If using on a RedHat/CentOS/Rocky Linux-based host, make sure you've added the EPEL repository (it can easily be installed by including the `geerlingguy.repo-epel` role on Ansible Galaxy).
|
||||
|
||||
## Role Variables
|
||||
|
||||
|
@ -20,6 +20,19 @@ Whether to install Ansible via the system `package` manager (`apt`, `yum`, `dnf`
|
|||
|
||||
If `ansible_install_method` is set to `pip`, the specific Ansible version to be installed via Pip. If not set, the latest version of Ansible will be installed.
|
||||
|
||||
ansible_install_pip_extra_args: ''
|
||||
|
||||
If `ansible_install_method` is set to `pip`, the extra arguments to be given to `pip` are listed here. If not set, no extra arguments are given.
|
||||
|
||||
ansible_pip_executable: ''
|
||||
|
||||
if `ansible_install_method` is set to `pip`, this is the path to the pip executable, in case your platform doesn't find the right name.
|
||||
|
||||
ansible_epel_repo_name: 'epel'
|
||||
|
||||
if `ansible_install_method` is set to `package` and you are on a RHEL machine, and your local satellite server admins decided to name the epel repository something other than epel, this variable gives you the opportunity to provide the right name.
|
||||
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
@ -38,6 +51,7 @@ Install from pip:
|
|||
vars:
|
||||
ansible_install_method: pip
|
||||
ansible_install_version_pip: "2.7.0"
|
||||
ansible_install_pip_extra_args: "--user"
|
||||
roles:
|
||||
- role: geerlingguy.pip
|
||||
- role: geerlingguy.ansible
|
||||
|
|
|
@ -6,3 +6,12 @@ ansible_install_method: package
|
|||
|
||||
# Used only if ansible_install_method is 'pip'. If empty, defaults to latest.
|
||||
ansible_install_version_pip: ''
|
||||
|
||||
# Which extra arguments should be gived to pip
|
||||
ansible_install_pip_extra_args: ''
|
||||
|
||||
# path to pip executable to use
|
||||
ansible_pip_executable: ''
|
||||
|
||||
# name of epel repo if it isn't standard
|
||||
ansible_epel_repo_name: 'epel'
|
||||
|
|
|
@ -6,12 +6,8 @@ galaxy_info:
|
|||
description: Ansible for RedHat/CentOS/Debian/Ubuntu.
|
||||
company: "Midwestern Mac, LLC"
|
||||
license: "license (BSD, MIT)"
|
||||
min_ansible_version: 2.4
|
||||
min_ansible_version: 2.10
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
- name: Fedora
|
||||
versions:
|
||||
- all
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
---
|
||||
role_name_check: 1
|
||||
dependency:
|
||||
name: galaxy
|
||||
options:
|
||||
ignore-errors: true
|
||||
driver:
|
||||
name: docker
|
||||
lint: |
|
||||
yamllint .
|
||||
ansible-lint
|
||||
platforms:
|
||||
- name: instance
|
||||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
|
||||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-rockylinux8}-ansible:latest"
|
||||
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:rw
|
||||
cgroupns_mode: host
|
||||
privileged: true
|
||||
pre_build_image: true
|
||||
provisioner:
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
|
||||
vars:
|
||||
ansible_install_method: pip
|
||||
ansible_pip_executable: pip3
|
||||
ansible_install_version_pip: "2.6.2"
|
||||
ansible_install_pip_extra_args: "--user"
|
||||
|
||||
roles:
|
||||
- role: geerlingguy.pip
|
|
@ -9,18 +9,25 @@
|
|||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- ansible_distribution != 'Fedora'
|
||||
- ansible_install_method == 'package'
|
||||
|
||||
- name: Set up Ansible on Fedora.
|
||||
include_tasks: setup-Fedora.yml
|
||||
when: ansible_distribution == 'Fedora'
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
- ansible_install_method == 'package'
|
||||
|
||||
- name: Set up Ansible on Ubuntu.
|
||||
include_tasks: setup-Ubuntu.yml
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
when:
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
- ansible_install_method == 'package'
|
||||
|
||||
- name: Set up Ansible on Debian.
|
||||
include_tasks: setup-Debian.yml
|
||||
when: ansible_distribution == 'Debian'
|
||||
when:
|
||||
- ansible_distribution == 'Debian'
|
||||
- ansible_install_method == 'package'
|
||||
|
||||
- name: Set up Ansible using Pip.
|
||||
include_tasks: setup-pip.yml
|
||||
|
|
|
@ -6,11 +6,9 @@
|
|||
{{ ansible_distribution_release }}-backports main'
|
||||
state: present
|
||||
filename: "{{ ansible_distribution_release }}_backports"
|
||||
update_cache: true
|
||||
when: ansible_distribution_version | int < 9
|
||||
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=true cache_valid_time=86400
|
||||
|
||||
- name: Set the default_release option for older Debian versions.
|
||||
set_fact:
|
||||
ansible_default_release: "{{ ansible_distribution_release }}-backports"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Install Ansible.
|
||||
yum:
|
||||
package:
|
||||
name: ansible
|
||||
state: "{{ ansible_package_state }}"
|
||||
enablerepo: epel
|
||||
enablerepo: "{{ ansible_epel_repo_name }}"
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
state: present
|
||||
|
||||
- name: Add ansible repository.
|
||||
apt_repository: repo='ppa:ansible/ansible'
|
||||
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=true cache_valid_time=86400
|
||||
apt_repository:
|
||||
repo: 'ppa:ansible/ansible'
|
||||
update_cache: true
|
||||
|
||||
- name: Install Ansible.
|
||||
apt:
|
||||
|
|
|
@ -2,4 +2,6 @@
|
|||
- name: Install Ansible via Pip.
|
||||
pip:
|
||||
name: ansible
|
||||
executable: "{{ ansible_pip_executable | default(omit) }}"
|
||||
version: "{{ ansible_install_version_pip | default(omit) }}"
|
||||
extra_args: "{{ ansible_install_pip_extra_args | default(omit) }}"
|
||||
|
|
Loading…
Reference in New Issue