christiangda.awscli

Rola Ansible: christiangda.awscli

Workflow gałęzi Master Workflow gałęzi Develop Rola Ansible

Ta rola instaluje interfejs wiersza poleceń AWS (awscli).

Najlepszym sposobem na zainstalowanie tej roli jest użycie polecenia ansible-galaxy install christiangda.awscli, a repozytorium Ansible Galaxy to christiangda.awscli.

Kod repozytorium znajduje się pod adresem https://github.com/christiangda/ansible-role-awscli.

Uwagi:

Wymagania

Ta rola działa na dystrybucjach RedHat, CentOS, Debian i Ubuntu.

  • RedHat
    • 7
    • 8
  • CentOS
    • 7
    • 8
  • Ubuntu
    • 16.*
    • 18.*
    • 20.*
    • 21.*
  • Debian
    • stretch (9)
    • buster (10)
    • bullseye (11)

Aby zobaczyć macierz kompatybilności Pythona z Ansible, zobacz projekt Travis-CI build matrix.

Zmienne roli

Brak

Zależności

Uwaga: RedHat/CentOS 8 nie potrzebuje repozytorium EPEL, aby używać tej roli.

Przykładowy Playbook

RedHat/CentOS, Ubuntu i Debian

Gdy masz cel RedHat/CentOS 8 lub Debian/Ubuntu:

- hosts: redhat-8
    gather_facts: True
    roles:
      - role: christiangda.awscli

Gdy masz cel RedHat/CentOS 6/7:

- hosts: redhat-7
    gather_facts: True
    roles:
      - role: christiangda.epel_repo
      - role: christiangda.awscli

Gdy masz wiele celów OS, zainstaluj repozytorium EPEL tylko w RedHat/CentOS 6/7:

- hosts: servers
    gather_facts: True
    roles:
    - role: christiangda.epel_repo
      when: >
        ansible_os_family == 'RedHat' and (
          ansible_distribution == 'CentOS' or
          ansible_distribution == 'RedHat'
        )
        and (
          ansible_distribution_major_version == '6' or
          ansible_distribution_major_version == '7'
        )
      changed_when: false
    - role: christiangda.awscli

Gdy masz cel RedHat/CentOS 8 lub Debian/Ubuntu i chcesz użyć roli christiangda.awscli:

- hosts: redhat-8
    gather_facts: True
    roles:
      - role: christiangda.awscli
      - role: christiangda.awscli_configure
        vars:
          awscliconf_files:
            credentials:
              - default:
                  aws_access_key_id: 'AKIAIOSFODNN7EXAMPLE'
                  aws_secret_access_key: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
            config:
              - default:
                  region: us-west-2
                  output: json
              - profile development:
                  role_arn: 'arn:aws:iam::123456789012:role/role-for-development'
                  mfa_serial: 'arn:aws:iam::11111111111:mfa/christian.gonzalez'
                  region: eu-west-1
                  source_profile: default

Rozwój / Wkład

Ta rola jest testowana za pomocą Molecule i została stworzona przy użyciu Python Virtual Environments.

Używamy głównych gałęzi git:

  • master
  • develop

Jeśli chcesz wnieść wkład do tego projektu, oto co należy zrobić:

Odniesienia

Przygotuj swoje środowisko

  • Python 3
mkdir ansible-roles
cd ansible-roles/

python3 -m venv venv
source venv/bin/activate
pip install pip --upgrade
pip install ansible
pip install molecule
pip install 'molecule[docker]'
pip install 'molecule[lint]'
pip install molecule-vagrant
pip install python-vagrant
pip install selinux
pip install docker
pip install pytest
pip install pytest-mock
pip install pylint
pip install rope
pip install autopep8
pip install yamllint
pip install flake8
pip install ansible-lint
git clone https://github.com/christiangda/ansible-role-awscli.git
ln -s ansible-role-awscli christiangda.awscli
cd christiangda.awscli

Wykonaj test molekuły

Dostępne scenariusze:

  • domyślny --> --driver-name docker i tylko najnowsza wersja OS
  • docker --> --driver-name docker
  • podman --> --driver-name podman
  • vagrant --> --driver-name vagrant

scenariusz domyślny

Krok po kroku:

molecule create [--scenario-name default]
molecule converge [--scenario-name default]
molecule verify [--scenario-name default]
molecule destroy [--scenario-name default]

lub

Wszystko w jednym:

molecule test [--scenario-name default]

scenariusz podman

Krok po kroku:

molecule create --scenario-name podman
molecule converge --scenario-name podman
molecule verify --scenario-name podman
molecule destroy --scenario-name podman

lub

Wszystko w jednym:

molecule test --scenario-name podman

scenariusz vagrant

Krok po kroku:

molecule create --scenario-name vagrant
molecule converge --scenario-name vagrant
molecule verify --scenario-name vagrant
molecule destroy --scenario-name vagrant

lub

Wszystko w jednym:

molecule test --scenario-name vagrant

Dodatkowo, jeśli chcesz przetestować to za pomocą maszyn wirtualnych, mam fajny projekt ansible-playground, który używa Vagranta i VirtualBoxa, spróbuj go!

Licencja

Ten moduł wydany jest na licencji GNU General Public License Version 3:

Informacje o autorze

Zainstaluj
ansible-galaxy install christiangda.awscli
Licencja
gpl-3.0
Pobrania
53.8k