improvements, not tested yet, not published
This commit is contained in:
parent
de54f56d25
commit
e26e27bc53
49
README.md
49
README.md
@ -1,8 +1,8 @@
|
||||
Hashicorp Consul
|
||||
Manage pip packages
|
||||
=========
|
||||
> This repository is only a mirror. Development and testing is done on a private gitlab server.
|
||||
|
||||
This role install and configure consul on **debian-based** distributions.
|
||||
This role enables you to manage python packages on debian-based distributions. It can be used on its own , or be called by other roles the install/remove packages on demand.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
@ -18,49 +18,6 @@ hashi_consul_install: true # by default, set to true
|
||||
```
|
||||
This variable defines if the consul package is to be installed or not before configuring. If you install consul using another task, you can set this to `false`.
|
||||
|
||||
```yaml
|
||||
hashi_consul_start_service: true
|
||||
```
|
||||
This variable defines if the consul service should be started once it has been configured. This is usefull in case you're using this role to build golden images, in which case you might want to only enable the service, to have it start on the next boot (when the image is launched)
|
||||
|
||||
```yaml
|
||||
hashi_consul_version: latest # by default, set to latest
|
||||
```
|
||||
This variable specifies the version of consul to install when `hashi_consul_install` is set to `true`. The version to specify is the version of the package on the hashicorp repository (`1.14.1-1` for example).
|
||||
|
||||
```yaml
|
||||
hashi_consul_deploy_method: host # by default, set to host
|
||||
```
|
||||
This variable defines the method of deployment of consul. The `host` method installs the binary directly on the host, and runs consul as a systemd service. The `docker` method install consul as a docker container.
|
||||
> Currently, only the `host` method is available, the `docker` method will be added later.
|
||||
|
||||
```yaml
|
||||
hashi_consul_server_enable: true # by default, set to true
|
||||
hashi_consul_connect_enable: false # by default, set to false
|
||||
hashi_consul_acl_enabled: false # by default, set to false
|
||||
```
|
||||
These variables enable or disable the server, service mesh and acl functions or consul.
|
||||
|
||||
```yaml
|
||||
hashi_consul_server:
|
||||
```
|
||||
This variable sets a bunch of configuration parameters for consul. For more information on all of them, please check the [documentation](https://developer.hashicorp.com/consul/docs/agent/config/config-files). I try to name them the same as in the configuration file, so that it is easier to search for it. Most of the defaults in the role are the default values of consul, however, some might differ.
|
||||
|
||||
```yaml
|
||||
hashi_consul_server_ports:
|
||||
```
|
||||
This variable sets up all of the ports used for consul communications. They default to the consul default values.
|
||||
|
||||
```yaml
|
||||
hashi_consul_client:
|
||||
```
|
||||
This variable is the list of servers to try to join on startup for agents. This only applies to agents, not servers (see `hashi_consul_server['retry_join']` for servers).
|
||||
|
||||
```yaml
|
||||
hashi_consul_acl:
|
||||
```
|
||||
This variable sets a bunch of settings regarding the ACLs in consul. YOU NEED TO EDIT IT if you decide to enable ACLs on the cluster (you might want to look into `lookup plugins` to fetch tokens from a secret manager, like [vault](https://docs.ansible.com/ansible/latest/collections/community/hashi_vault/hashi_vault_lookup.html) or [bitwarden](https://docs.ansible.com/ansible/latest/collections/community/general/bitwarden_lookup.html)).
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
@ -74,7 +31,7 @@ Including an example of how to use your role (for instance, with variables passe
|
||||
# calling the role inside a playbook with either the default or group_vars/host_vars
|
||||
- hosts: servers
|
||||
roles:
|
||||
- ednxzu.hashicorp_consul
|
||||
- ednxzu.manage_pip_packages
|
||||
```
|
||||
|
||||
License
|
||||
|
@ -3,6 +3,6 @@
|
||||
manage_pip_packages_install_python: true
|
||||
manage_pip_packages_install_pip: true
|
||||
manage_pip_packages_list:
|
||||
- name: nginx
|
||||
version: latest
|
||||
state: absent
|
||||
- name: pip
|
||||
version_constraint: latest
|
||||
state: present
|
||||
|
@ -1,53 +1,25 @@
|
||||
---
|
||||
# meta file for manage_pip_packages
|
||||
galaxy_info:
|
||||
author: your name
|
||||
namespace: ednxzu
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.1
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
namespace: 'ednxzu'
|
||||
role_name: 'manage_pip_packages'
|
||||
author: 'Bertrand Lanson'
|
||||
description: 'Package management for python on debian-based distros.'
|
||||
license: 'license (BSD, MIT)'
|
||||
min_ansible_version: '2.10'
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- focal
|
||||
- jammy
|
||||
- name: Debian
|
||||
versions:
|
||||
- bullseye
|
||||
galaxy_tags:
|
||||
- 'ubuntu'
|
||||
- 'debian'
|
||||
- 'python3'
|
||||
- 'pip'
|
||||
- 'packages'
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
|
4
meta/requirements.yml
Normal file
4
meta/requirements.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
# meta file for hashicorp_consul
|
||||
roles:
|
||||
- name: ednxzu.manage_apt_packages
|
@ -1,3 +1,4 @@
|
||||
---
|
||||
# requirements file for molecule
|
||||
roles: []
|
||||
roles:
|
||||
- name: ednxzu.manage_apt_packages
|
||||
|
@ -1,2 +1,13 @@
|
||||
---
|
||||
# task/main file for manage_pip_packages
|
||||
- name: "Import prerequisites.yml"
|
||||
ansible.builtin.include_tasks: prerequisites.yml
|
||||
when: manage_pip_packages_install_python
|
||||
|
||||
- name: "Install/remove required packages"
|
||||
ansible.builtin.pip:
|
||||
name: "{{ item.name }}{% if item.version_constraint not in [None, '', 'latest'] %}{{ item.version_constraint }}{% endif %}"
|
||||
state: "{{ item.state }}"
|
||||
loop: "{{ manage_pip_packages_list }}"
|
||||
when: manage_pip_packages_list is defined
|
||||
and manage_pip_packages_list not in [None, '']
|
||||
|
13
tasks/prerequisites.yml
Normal file
13
tasks/prerequisites.yml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
# task/prerequisites file for manage_pip_packages
|
||||
- name: "Install python3 and pip"
|
||||
ansible.builtin.include_role:
|
||||
name: ednxzu.manage_apt_packages
|
||||
vars:
|
||||
manage_apt_packages_list:
|
||||
- name: "{{ manage_pip_packages_python3_package_name }}"
|
||||
version: latest
|
||||
state: present
|
||||
- name: "{{ manage_pip_packages_pip3_package_name }}"
|
||||
version: latest
|
||||
state: present
|
@ -1,2 +1,4 @@
|
||||
---
|
||||
# vars file for manage_pip_packages
|
||||
manage_pip_packages_python3_package_name: python3
|
||||
manage_pip_packages_pip3_package_name: python3-pip
|
||||
|
Loading…
Reference in New Issue
Block a user