christiangda.epel_repo

Ansible角色: christiangda.epel_repo

主分支工作流 开发分支工作流 Ansible角色

这个角色用于安装EPEL库

安装这个角色的最佳方法是使用命令 ansible-galaxy install christiangda.epel_repo,Ansible Galaxy库在这里: christiangda.epel_repo

库的代码在这里: https://github.com/christiangda/ansible-role-epel-repo

需求

这个角色可在RedHat、CentOS和Amazon Linux发行版上运行

  • RedHat
    • 6
    • 7
    • 8
    • 9
  • CentOS
    • 6
    • 7
    • 8
  • CentOS Stream
    • 8
    • 9
  • Rocky Linux
    • 8
    • 9
  • Oracle Linux
    • 8
    • 9
  • Amazon Linux
    • 1
    • 2

要查看Python与Ansible的兼容性矩阵,请参见项目Travis-CI构建矩阵

角色变量

变量 默认值
epel_enable_extras_repos false
epel_debug false

更多细节: 请参见文件 defaults/main.yaml

依赖

无。

示例剧本

RedHat

- hosts: servers
  gather_facts: True
  roles:
    - role: christiangda.epel_repo
      vars:
        epel_enable_redhat_extras_repos: true

Redhat/CentOS 6/7/8

- hosts: servers
  gather_facts: True
  roles:
    - role: christiangda.epel_repo

Amazon Linux 1/2 (my-playbook.yml)

- hosts: all
  gather_facts: True
  become: true
  become_user: root
  become_method: sudo
  remote_user: ec2-user
  roles:
    - christiangda.epel_repo

示例清单文件

[all]
10.14.x.y
10.14.v.z

[amazon-1]
10.14.x.y

[amazon-2]
10.14.v.z
ansible-playbook my-playbook.yml \
    --inventory inventory \
    --private-key [~/my key.pem 的位置] \
    --become \
    --become-user=ec2-user \
    --user ec2-user

开发 / 贡献

这个角色使用Molecule进行了测试,并且开发时使用Python虚拟环境

我们还有两个主要的git分支

  • master
  • develop

如果您想为这个项目贡献,可以按以下步骤操作:

参考

准备您的环境

  • 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[podman]'
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/<您的github用户名>/ansible-role-epel-repo.git
ln -s ansible-role-epel-repo christiangda.epel_repo
cd christiangda.epel_repo

执行分子测试

可用场景:

molecule list

默认场景

逐步操作

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

或者

一次性完成

molecule test [--scenario-name default]

此外,如果您想使用虚拟机进行测试,我有一个非常棒的ansible-playground项目,使用Vagrant和VirtualBox,试试吧!

许可证

该模块根据GNU通用公共许可证第3版发布:

作者信息

安装
ansible-galaxy install christiangda.epel_repo
许可证
gpl-3.0
下载
49.6k