promise-type-ansible

Promise type to run ansible playbooks

Maintainer

Fabio Tranchitella

Module stats

Total Downloads: 1338
Updated: Nov 3, 2021

Installation version

Version
Released on Nov 1, 2021

Tags

Installation

                    
cfbs add promise-type-ansible
Description
Dependencies
Comments

ansible promise module

Synopsis

  • Name: ansible
  • Version: 0.1.1
  • Description: Run Ansible playbooks

Requirements

  • Ansible >= 2.8.0

Attributes

Name Type Description Mandatory Default
playbook string Absolute path of the Ansible playbook No Promiser
inventory string Absolute path of the inventory file No -
limit slist List of host names to target No {"localhost"}
tags slist List of tags to play No {}
become boolean Set the become option No False
become_method string Set the become_method option No "sudo"
become_user string Set the become_user option No root
connection string Set the connection option; possible values: local, ssh No local
forks int Set the forks option No 1
private_key_file string Absolute path of the SSH private key to use No -
remote_user string Set the remote_user option No root

Examples

Play the /northern.tech/playbook.yaml playbook locally, using /northern.tech/inventory.yaml, and limiting the execution to the helloworld tag:

bundle agent main
{
  ansible:
    "my_playbook"
      playbook   => "/northern.tech/playbook.yaml",
      inventory  => "/northern.tech/inventory.yaml",
      tags       => {"helloworld"};
}

This promise can run ansible over ssh targeting multiple hosts, for example:

bundle agent main
{
  ansible:
    "my_playbook"
      playbook         => "/northern.tech/playbook.yaml",
      inventory        => "/northern.tech/inventory.yaml",
      become           => "true",
      become_method    => "sudo",
      become_user      => "root",
      connection       => "ssh",
      forks            => int(eval("4 * $(sys.cpus)")),
      remote_user      => "ubuntu",
      limit            => {"host1", "host2", "host3", "host4"},
      private_key_file => "/path/to/your/private/key/id_rsa";
}

Authors

This software was created by the team at Northern.tech AS, with many contributions from the community. Thanks everyone!

CFEngine is sponsored by Northern.tech AS

Contribute

Feel free to open pull requests to expand this documentation, add features or fix problems. You can also pick up an existing task or file an issue in our bug tracker.

License

This software is licensed under the MIT License. See LICENSE in the root of the repository for the full license text.

comments powered by Disqus