GithubHelp home page GithubHelp logo

ansible-role-common-packages's Introduction

Ansible role common-packages

variables of the role

Variable autoremove_packages

  • autoremove_packages - yes/no. Only for package manager: apt|dnf, meets the requirements of autoremove.

Variables list_packages / list_services

  • host_group_names_inventory - the parameter lists the list of servers or groups from inventory on which the package should be installed. ** The absence of a parameter ** is equivalent to specifying all, the package is installed on all servers.
  • os_family - the parameter corresponds to the facts from ansible_os_family. Lists are supported. ** Missing a parameter ** is equivalent to specifying all.
  • os_distribution - the parameter corresponds to the facts from ansible_distribution. Lists are supported. ** Missing a parameter ** is equivalent to specifying all.
  • os_distribution_major_version - the parameter corresponds to the facts from ansible_distribution_major_version. Lists are supported. ** Missing a parameter ** is equivalent to specifying all.

Variable list_packages

Supplementary to your specified ** optional ** fact and inventory attributes for list_packages are supported:

  • packages_manager - the parameter corresponds to the facts from ansible_pkg_mgr. Lists are supported. ** Missing a parameter ** is equivalent to specifying all.

Supported section attributes packages:

  • name - name of package.
  • state - optionaly, the default value is present, supports values present/latest/absent

Variable example:

list_packages:
  - name: "Packages for All servers"
    packages:
      - name: package_name1
        #state: present (по умолчанию, если не указано)
      - name: package_name2
        state: latest
      - name: package_name3
        state: absent
  - name: "Packages for All RedHat servers (<= 7)"
    packages_manager: yum
    packages:
      - name: package_name4
  - name: "Packages for All RedHat servers (>= 8)"
    packages_manager: dnf
    packages:
      - name: package_name4
  - name: "Packages for All Deb servers"
    packages_manager: apt
    packages:
      - name: package_name4
  - name: "Packages for Specific servers"
    os_distribution: Ubuntu
    packages:
      - name: package_name5
  - name: "Packages for Specific servers"
    packages_manager: apt
    os_distribution_major_version:
      - "16"
      - "18"
    packages:
      - name: package_name6
  - name: "Packages for Specific servers"
    packages_manager: apt
    os_distribution_major_version: "18"
    host_group_names_inventory:
      - group1
      - group2
    packages:
      - name: package_name7

variable list_services

Supported attributes of the services section, the values ​​of which correspond to the parameters of the service module in ansible:

  • name
  • enabled
  • state
  • runlevel
  • sleep
  • arguments
  • use
  • pattern

Variable example:

list_services:
  - name: "Services on All servers"
    services:
      - name: service_name1
        enabled: yes
        state: started
      - name: service_name2
        enabled: yes
        state: started
      - name: service_name3
        enabled: yes
        state: started
  - name: "Services on All RedHat servers (<= 7)"
    services_manager: yum
    services:
      - name: service_name4
        enabled: yes
        state: started
  - name: "Services on All RedHat servers (>= 8)"
    services_manager: dnf
    services:
      - name: service_name4
        enabled: yes
        state: started
  - name: "Services on All Deb servers"
    services_manager: apt
    services:
      - name: service_name4
        enabled: yes
        state: started
  - name: "Services on Specific servers"
    os_distribution: Ubuntu
    services:
      - name: service_name5
        enabled: yes
        state: started
  - name: "Services on Specific servers"
    services_manager: apt
    os_distribution_major_version:
      - "18"
    services:
      - name: service_name6
        enabled: yes
        state: started
  - name: "Services on Specific servers"
    services_manager: apt
    os_distribution_major_version: "18"
    host_group_names_inventory:
      - group1
      - group2
    services:
      - name: service_name7
        enabled: yes
        state: started

Example playbook

- name: Install packages
  become: true
  roles:
    - common-packages

ansible-role-common-packages's People

Contributors

includerandom avatar

Watchers

 avatar  avatar

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.