Skip to content

ivotron/ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github Action for Ansible

Wrapper around Ansible.

Usage

The action checks for a ANSIBLE_GALAXY_FILE variable and, if exists, passes its content to ansible-galaxy to install dependencies (mazer and pip can be used as well; see below). The entrypoint to the action is the ansible-playbook command.

Example workflow

workflow "Run Ansible playbook" {
  on = "push"
  resolves = "run ansible"
}

action "run ansible" {
  uses = "popperized/ansible@master"
  args = "-i mystuff/hosts.ini mystuff/playbook.yml"
  env = {
    ANSIBLE_GALAXY_FILE = "mystuff/requirements.yml"
  }
  secrets = ["ANSIBLE_SSH_KEY_DATA"]
}

TIP: to disable host key checking, the workflow can define the env varaible:

ANSIBLE_HOST_KEY_CHECKING = "False"

This variable is not used by the action, but it's read by Ansible instead. See the official documentation to obtain a list of environment variables that Ansible can read.

Environment

  • ANSIBLE_GALAXY_FILE. Optional Path to file containing an ansible-galaxy requirements file. Dependencies are installed to $HOME/.ansible.

  • ANSIBLE_MAZER_LOCKFILE. Optional Path to mazer lockfile to install galaxy content. Dependencies are installed to $HOME/.ansible.

  • ANSIBLE_PIP_FILE. Optional Path to a requirements.txt file that is passed to pip install -r.

Secrets

  • ANSIBLE_SSH_KEY_DATA. Required A base64-encoded string containing the private key used to authenticate with hosts referenced in the ansible inventory. Example encoding from a terminal: cat ~/.ssh/id_rsa | base64

License

MIT. Please see additional information in each subdirectory.

About

Github Action for Ansible

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published