Skip to content

Commit

Permalink
Merge pull request #693 from manala/update-ansible-2.15
Browse files Browse the repository at this point in the history
Update ansible 2.15
  • Loading branch information
nervo authored Oct 20, 2023
2 parents aa2ae17 + 89ce77e commit e1205fe
Show file tree
Hide file tree
Showing 104 changed files with 174 additions and 201 deletions.
10 changes: 5 additions & 5 deletions .manala.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ system:
[safe]
directory = *
ansible:
version: 2.14.3
version: 2.15.5
dependencies:
# Collection community.docker
- docker==6.0.1
- docker==6.1.3
ansible-lint:
version: 6.14.2
version: 6.14.6
molecule:
version: 5.0.1
dependencies:
- molecule-plugins==23.4.1
- molecule-plugins[docker]==23.4.1
- molecule-plugins==23.5.0
- molecule-plugins[docker]==23.5.0
2 changes: 1 addition & 1 deletion .manala/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ clean:
$(manala_docker) images \
--filter reference='manala-ansible-roles:*' \
--format "{{.ID}}" \
| xargs $(manala_docker) rmi --force
| xargs -r $(manala_docker) rmi --force
@$(call manala_log, Delete cache dir…)
rm -Rf $(MANALA_DIR)/$(MANALA_CACHE_DIR)
.PHONY: clean
Expand Down
35 changes: 18 additions & 17 deletions .manala/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# Base #
########

FROM debian:bullseye-slim
FROM debian:bookworm-slim

ARG DEBIAN_FRONTEND="noninteractive"

ARG MANALA_USER_ID="1000"
ARG MANALA_GROUP_ID="1000"

ARG GOSU_VERSION="1.16"
ARG GOMPLATE_VERSION="3.11.4"
ARG GOMPLATE_VERSION="3.11.5"

# The 'container' environment variable tells systemd that it's running inside a
# Docker container environment.
Expand All @@ -20,9 +20,7 @@ ENV container="docker"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN \
# Backports
echo "deb http://deb.debian.org/debian $(. /etc/os-release; echo "${VERSION_CODENAME}")-backports main" > /etc/apt/sources.list.d/backports.list \
&& apt-get --quiet update \
apt-get --quiet update \
&& apt-get --quiet --yes --purge --autoremove upgrade \
&& apt-get --quiet --yes --no-install-recommends --verbose-versions install \
s6 \
Expand All @@ -38,12 +36,10 @@ RUN \
less \
vim \
socat \
# Apt keyrings (debian < bookworm)
&& mkdir --verbose --parents /etc/apt/keyrings \
# User
&& addgroup --gid ${MANALA_GROUP_ID} lazy \
&& adduser --home /home/lazy --shell /bin/bash --uid ${MANALA_USER_ID} --gecos lazy --ingroup lazy --disabled-password lazy \
&& mkdir --verbose --parents /run/user/${MANALA_USER_ID} && chown lazy:lazy /run/user/${MANALA_USER_ID} \
&& install --verbose --mode 0755 --group lazy --owner lazy --directory /run/user/${MANALA_USER_ID} \
&& echo "lazy ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/lazy \
# Gosu
&& curl -sSL "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-$(case $(dpkg --print-architecture) in "amd64") echo "amd64" ;; "arm64") echo "arm64" ;; esac)" \
Expand All @@ -54,7 +50,7 @@ RUN \
--output /usr/local/bin/gomplate \
&& chmod +x /usr/local/bin/gomplate \
# Bash completion
&& mkdir --verbose --parents /etc/bash_completion.d \
&& install --verbose --mode 0755 --directory /etc/bash_completion.d \
# Oh My Bash
&& git clone https://github.com/ohmybash/oh-my-bash.git /usr/local/share/oh-my-bash \
# Clean
Expand All @@ -79,15 +75,20 @@ RUN \
# Sudo
&& echo "Defaults env_keep += \"PIPX_*\"" > /etc/sudoers.d/pipx \
# Bash completion
&& activate-global-python-argcomplete3 --dest /etc/bash_completion.d \
&& activate-global-python-argcomplete --dest /etc/bash_completion.d \
# Clean
&& rm -rf /var/lib/apt/lists/*

# Docker
RUN \
curl -sSL https://download.docker.com/linux/debian/gpg \
| gpg --dearmor --output /etc/apt/keyrings/docker.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(. /etc/os-release; echo "${VERSION_CODENAME}") stable" > /etc/apt/sources.list.d/docker.list \
--output /etc/apt/keyrings/docker.asc \
&& printf "Types: deb\n\
URIs: https://download.docker.com/linux/debian\n\
Suites: $(. /etc/os-release; echo "${VERSION_CODENAME}")\n\
Components: stable\n\
Signed-By: /etc/apt/keyrings/docker.asc\n\
" > /etc/apt/sources.list.d/docker.sources \
&& apt-get --quiet update \
&& apt-get --quiet --yes --no-install-recommends --verbose-versions install \
docker-ce-cli \
Expand All @@ -97,9 +98,9 @@ RUN \
# Ansible
RUN \
pipx install --pip-args="--no-cache-dir" \
ansible-core==2.14.3 \
ansible-core==2.15.5 \
&& pipx inject --pip-args="--no-cache-dir" ansible-core \
docker==6.0.1
docker==6.1.3

# Ansible Lint
RUN \
Expand All @@ -110,7 +111,7 @@ RUN \
&& apt-get --quiet --yes --no-install-recommends --verbose-versions install \
"${BUILD_PACKAGES[@]}" \
&& pipx install --pip-args="--no-cache-dir" \
ansible-lint==6.14.2 \
ansible-lint==6.14.6 \
# Clean
&& apt-get --quiet --yes --autoremove purge \
"${BUILD_PACKAGES[@]}" \
Expand All @@ -122,8 +123,8 @@ RUN \
molecule==5.0.1 \
&& _MOLECULE_COMPLETE=bash_source molecule > /etc/bash_completion.d/molecule \
&& pipx inject --pip-args="--no-cache-dir" molecule \
molecule-plugins==23.4.1 \
molecule-plugins[docker]==23.4.1
molecule-plugins==23.5.0 \
molecule-plugins[docker]==23.5.0

# Run
COPY docker/entrypoint.sh /
Expand Down
2 changes: 1 addition & 1 deletion .manala/docker/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
build:
context: ..
dockerfile: docker/Dockerfile
image: manala-ansible-roles:20230612092011
image: manala-ansible-roles:20231019094123
volumes:
- ../..:${MANALA_DIR}
environment:
Expand Down
10 changes: 5 additions & 5 deletions .manala/etc/profile.d/message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ printf "\033[34m =-=-_-__=_-= _=_=-=_,-'\033[32m|\033[34m\"'\"\"-\033[32m|\033[3
printf "\033[34m =- _=-=- -_=-=_,-\" \033[32m|\033[34m\"\033[0m\n"
printf "\033[34m =- =- -=.--\"\033[0m\n"
printf "\n"
printf " \033[36m‣ ansible \033[35m2.14.3\033[0m\n"
printf " \033[36m· docker==6.0.1\033[0m\n"
printf " \033[36m‣ ansible-lint \033[35m6.14.2\033[0m\n"
printf " \033[36m‣ ansible \033[35m2.15.5\033[0m\n"
printf " \033[36m· docker==6.1.3\033[0m\n"
printf " \033[36m‣ ansible-lint \033[35m6.14.6\033[0m\n"
printf " \033[36m‣ molecule \033[35m5.0.1\033[0m\n"
printf " \033[36m· molecule-plugins==23.4.1\033[0m\n"
printf " \033[36m· molecule-plugins[docker]==23.4.1\033[0m\n"
printf " \033[36m· molecule-plugins==23.5.0\033[0m\n"
printf " \033[36m· molecule-plugins[docker]==23.5.0\033[0m\n"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Changed
- [All] Update minimum version of ansible to 2.15
- [Apt] Switch influxdata repository to "stable"
- [Apt] Remove apt-transport-https default package
- [Apt] Update Grafana key
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test.sanity:
$(call manala_docker_shell, ansible-test sanity \
--requirements \
--venv \
--python 3.9 \
--python 3.11 \
$(if $(VERBOSE), --verbose) \
--color yes \
--exclude .github/ \
Expand All @@ -40,7 +40,7 @@ test.units:
$(call manala_docker_shell, ansible-test units \
--requirements \
--venv \
--python 3.9 \
--python 3.11 \
$(if $(VERBOSE), --verbose) \
$(if $(COVERAGE), --coverage) \
--color yes \
Expand All @@ -52,7 +52,7 @@ test.integration:
$(call manala_docker_shell, ansible-test integration \
--requirements \
--venv \
--python 3.9 \
--python 3.11 \
$(if $(VERBOSE), --verbose) \
$(if $(COVERAGE), --coverage) \
--color yes \
Expand All @@ -64,7 +64,7 @@ test.coverage:
$(call manala_docker_shell, ansible-test coverage xml \
--requirements \
--venv \
--python 3.9 \
--python 3.11 \
--group-by command \
--group-by version \
$(if $(VERBOSE), --verbose) \
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ molecule converge -s [role] -- -t [tag]

Launch sanity tests (first time with `--requirements`)
```shell
ansible-test sanity --python 3.9 --requirements
ansible-test sanity --python 3.9
ansible-test sanity --python 3.11 --requirements
ansible-test sanity --python 3.11
```

Launch units tests (first time with `--requirements`) over a specific file or not
```shell
ansible-test units --python 3.9 --requirements
ansible-test units --python 3.9
ansible-test units --python 3.9 tests/unit/plugins/lookup/test_foo.py
ansible-test units --python 3.11 --requirements
ansible-test units --python 3.11
ansible-test units --python 3.11 tests/unit/plugins/lookup/test_foo.py
```

## Licensing
Expand Down
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---

requires_ansible: '>=2.14.0'
requires_ansible: '>=2.15.0'
25 changes: 24 additions & 1 deletion molecule/mysql.mariadb.10.11/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
password: foo
host: localhost
priv: "*.*:ALL,GRANT"
login_unix_socket: /var/run/mysqld/mysqld.sock
manala_mysql_databases:
- name: foo
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Goss
ansible.builtin.command:
cmd: goss --gossfile - validate
Expand Down Expand Up @@ -55,8 +57,8 @@
manala_mysql_users:
- name: foo
password: foo
login_unix_socket: /var/run/mysqld/mysqld.sock
priv: "*.*:ALL,GRANT"
login_unix_socket: /var/run/mysqld/mysqld.sock
manala_mysql_databases:
- name: foo
login_unix_socket: /var/run/mysqld/mysqld.sock
Expand Down Expand Up @@ -314,42 +316,53 @@
- mariadb-client
manala_mysql_users:
- name: bar
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create users to absent/ignore later
community.mysql.mysql_user:
user: "{{ item }}"
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
loop: [
state_absent_existing, state_ignore_existing,
]
- block: # noqa name[missing]
- name: Role
ansible.builtin.import_role:
name: manala.roles.mysql
tasks_from: users
vars:
manala_mysql_users:
# Privileges and password
- name: foo
password: foo
host: localhost
priv: "*.*:ALL,GRANT"
login_unix_socket: /var/run/mysqld/mysqld.sock
# States
- name: state_present_implicit
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_present
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_absent
state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_absent_existing
state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_ignored
state: ignore
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_ignore_existing
state: ignore
login_unix_socket: /var/run/mysqld/mysqld.sock
# Flatten
-
- name: baz
password: baz
host: localhost
priv: "*.*:ALL,GRANT"
login_unix_socket: /var/run/mysqld/mysqld.sock
always:
- name: Goss
ansible.builtin.command:
Expand All @@ -376,34 +389,44 @@
manala_mysql_databases:
- name: bar
state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Create databases to absent/ignore later
community.mysql.mysql_db:
name: "{{ item }}"
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
loop: [
state_absent_existing, state_ignore_existing,
]
- block: # noqa name[missing]
- name: Role
ansible.builtin.import_role:
name: manala.roles.mysql
tasks_from: databases
vars:
manala_mysql_databases:
# States
- name: state_present_implicit
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_present
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_absent
state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_absent_existing
state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_ignored
state: ignore
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: state_ignore_existing
state: ignore
login_unix_socket: /var/run/mysqld/mysqld.sock
# Flatten
-
- name: baz
login_unix_socket: /var/run/mysqld/mysqld.sock
always:
- name: Goss
ansible.builtin.command:
Expand Down
Loading

0 comments on commit e1205fe

Please sign in to comment.