Coder Social home page Coder Social logo

geerlingguy / ansible-role-ansible Goto Github PK

View Code? Open in Web Editor NEW
142.0 11.0 87.0 46 KB

Ansible Role - Ansible

Home Page: https://galaxy.ansible.com/geerlingguy/ansible/

License: MIT License

ansible role install software setup pip python automation

ansible-role-ansible's Introduction

Ansible Role: Ansible

CI

An Ansible Role that installs Ansible on Linux servers.

Requirements

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

Available variables are listed below, along with default values (see defaults/main.yml):

ansible_install_method: package

Whether to install Ansible via the system package manager (apt, yum, dnf, etc.), or via pip. If set to pip, you need to make sure Pip is installed prior to running this role. You can use the geerlingguy.pip module to install Pip easily.

ansible_install_version_pip: ''

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.

Example Playbook

Install from the system package manager:

- hosts: servers
  roles:
    - role: geerlingguy.ansible

Install from pip:

- hosts: servers
  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

License

MIT / BSD

Author Information

This role was created in 2014 by Jeff Geerling, author of Ansible for DevOps.

ansible-role-ansible's People

Contributors

d4rkstar avatar firefishy avatar geerlingguy avatar morganlindqvist avatar phreddrick avatar tobiasehlert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-ansible's Issues

Add possibility to add extra arguments to pip install ansible

Hi,

Nice script, I would however like to have the possibility to give an extra argument to the pip install command. In my case I would like to be able to pass on "--user".

I have created a PR to enable this that I will commit shortly.

Comments?

"The conditional check 'ansible_distribution_version < 9' failed"

I'm running Ansible 2.7.0 against a Debian Stretch server.

Ansible:

[user@ansible-host: /etc/ansible]$ ansible --version
ansible 2.7.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.0 (default, Sep 15 2018, 19:13:07) [GCC 8.2.1 20180831]

Playbook:

---
- hosts: "{{ server }}"
  become: true
  roles:
      - role: geerlingguy.ansible

The error I'm receiving:

TASK [geerlingguy.ansible : Set the default_release option for older Debian versions.] ********************************************************************************************************************************************
fatal: [cdc-s-ansibleci01]: FAILED! => {"msg": "The conditional check 'ansible_distribution_version < 9' failed. The error was: Unexpected templating type error occurred on ({% if ansible_distribution_version < 9 %} True {% else %} False {% endif %}): '<' not supported between instances of 'AnsibleUnsafeText' and 'int'[...]"}

I was able to resolve this by adding "| int" to ~/.ansible/roles/geerlingguy.ansible/tasks/setup-Debian.yml:

-when: ansible_distribution_version < 9
+when: ansible_distribution_version | int < 9

I am still learning, so I do not know what causes this issue, nor if this is the proper way to fix this.

How this role could be working ?

To be honest, I'm new to Ansible itself.
Does it make sense that installation of Ansible is possible by ansible-playbook ?
As I understand, installation of Ansible is prerequisite for running any playbook.
Please correct me if I have wrong information.
Thanks in advance.

Allow define umask

To install system wide, if we have defined different default umask, it might be usefull to add umask to the setup-pip.yml

Ansible Galaxy installation issue

Hi,

unfortunately, this role is not installable via Ansible Galaxy due to strange error: https://galaxy.ansible.com/list#/roles/1007. As you can see there's some weird issue with role name under Installation section: $ ansible-galaxy install geerlingguy..

The output of the installation process via ansible-galaxy:

andrzej@PC:~/workspace$ ansible-galaxy install -r requirements.yml
- downloading role 'ansible', owned by geerlingguy
- sorry, geerlingguy.ansible was not found on galaxy.ansible.com.
- you can use --ignore-errors to skip failed roles.

docs: Pip Executable var needs to be set

Actual Behaviour

If using the example playbook

The Task fails:

TASK [geerlingguy.ansible : Install Ansible via Pip.] **************************************************************************
fatal: [examle_host]: FAILED! => {"changed": false, "msg": "Unable to find any of  to use.  pip needs to be installed."}

Full run:

TASK [geerlingguy.pip : Ensure Pip is installed.] ******************************************************************************
ok: [examle_host]

TASK [geerlingguy.pip : Ensure pip_install_packages are installed.] ************************************************************
skipping: [examle_host]

TASK [geerlingguy.ansible : Set the package state based on how Ansible is installed.] ******************************************
ok: [examle_host]

TASK [geerlingguy.ansible : Set up Ansible on RedHat.] *************************************************************************
skipping: [examle_host]

TASK [geerlingguy.ansible : Set up Ansible on Fedora.] *************************************************************************
skipping: [examle_host]

TASK [geerlingguy.ansible : Set up Ansible on Ubuntu.] *************************************************************************
skipping: [examle_host]

TASK [geerlingguy.ansible : Set up Ansible on Debian.] *************************************************************************
skipping: [examle_host]

TASK [geerlingguy.ansible : Set up Ansible using Pip.] *************************************************************************
included: /home/[example_user]/.ansible/roles/geerlingguy.ansible/tasks/setup-pip.yml for [example_host]

TASK [geerlingguy.ansible : Install Ansible via Pip.] **************************************************************************
fatal: [examle_host]: FAILED! => {"changed": false, "msg": "Unable to find any of  to use.  pip needs to be installed."}

Solution

The ansible_pip_executable: pip3 needs to be set as in the CI build

Error on playbook for Ubuntu 20

Hey,
I'm trying to run this role and I get:

TASK [geerlingguy.ansible : Add ansible repository.] ****************************************************************************
fatal: [192.168.1.14]: FAILED! => {"changed": false, "msg": "apt cache update failed"}

Invalid supported OS specification (the role is not working on Debian)

The role is said to support Debian, but it fails to install the ansible repository on Debian systems, like that:

TASK [ansible : Add ansible repository.] ***********************************
fatal: [host.example.com]: FAILED! => {"changed": false, "failed": true, "msg": "Invalid repository string: ppa:ansible/ansible"}

accordingly to the documentation: http://docs.ansible.com/ansible/apt_repository_module.html

# On Ubuntu target: add nginx stable repository from PPA and install its signing key.
# On Debian target: adding PPA is not available, so it will fail immediately.
apt_repository: repo='ppa:nginx/stable'

Allow dependancies for pip installation

To install ansible via pip on fresh installs, it might needs somes dependancies (ex : gcc, python-devel, openssl-devel on RHEL)

Example in tasks.yml

- name: Install dependancies for pip installation.
  package:
    name: "{{ ansible_pip_dependancies }}"
    state: present

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.