Skip to content

Commit

Permalink
Support Alpine 16 and newer
Browse files Browse the repository at this point in the history
It would allow running it in Docker Playground.

Signed-off-by: Cédric Ollivier <[email protected]>
  • Loading branch information
collivier committed Feb 11, 2023
1 parent 6e4dbef commit b2d7540
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 4 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,24 @@ ansible-galaxy collection install ansible.posix community.general community.graf
community.kubernetes community.docker community.postgresql
```

Install dependencies (Alpine 3.16):
```bash
sudo apk update && sudo apk add git
[ -z "$VIRTUAL_ENV" ] && sudo apk add ansible
ansible-galaxy install collivier.xtesting
ansible-galaxy collection install ansible.posix community.general community.grafana \
community.kubernetes community.docker community.postgresql
```

**Install dependencies (Alpine 3.17):**
```bash
sudo apk update && sudo apk add git
[ -z "$VIRTUAL_ENV" ] && sudo apk add ansible
ansible-galaxy install collivier.xtesting
ansible-galaxy collection install ansible.posix community.general community.grafana \
community.kubernetes community.docker community.postgresql
```

## If proxy

All Xtesting CI playbooks could be executed behind a proxy and the proxy
Expand Down
3 changes: 1 addition & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
- name: Restarting Docker
become: true
ansible.builtin.systemd:
ansible.builtin.service:
name: docker
daemon_reload: true
state: restarted
notify:
- Pausing 10 seconds
Expand Down
3 changes: 3 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ galaxy_info:
- '7'
- '8'
- '9'
- name: "Alpine"
versions:
- all
galaxy_tags: []
dependencies: []
152 changes: 152 additions & 0 deletions tasks/alpine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
---
- name: Checking Alpine version
ansible.builtin.fail:
msg: Only Alpine 16 and newer are supported
when:
- "ansible_distribution_version is version('3.16.0', 'lt', version_type='semver')"
- name: Gathering the package facts
ansible.builtin.package_facts:
manager: auto
- name: Installing py3-pip and py3-setuptools
become: true
ansible.builtin.apk:
name:
- py3-pip
- py3-setuptools
update_cache: true
register: apk_res
retries: 5
until: apk_res is success
when:
- not lookup('env', 'VIRTUAL_ENV')
- name: Installing docker
become: true
ansible.builtin.apk:
name:
- docker
update_cache: true
register: apk_res
retries: 5
until: apk_res is success
- name: Installing py3-certifi, py3-charset-normalizer, py3-fasteners,
py3-pbr, py3-requests, py3-urllib3 and py3-multi-key-dict
become: true
ansible.builtin.apk:
name:
- py3-certifi
- py3-charset-normalizer
- py3-fasteners
- py3-pbr
- py3-requests
- py3-urllib3
- py3-multi-key-dict
update_cache: true
register: apk_res
retries: 5
until: apk_res is success
when:
- jenkins_deploy or jenkins_configure or jenkins_create_jobs
- name: Installing stevedore, python-jenkins and jenkins-job-builder via pip
become: "{{ not lookup('env', 'VIRTUAL_ENV') }}"
ansible.builtin.pip:
name:
- stevedore<=1.31.0
- python-jenkins<=1.7.0
- jenkins-job-builder<=4.1.0
extra_args: --no-deps
when:
- jenkins_deploy or jenkins_configure
- name: Installing py3-jmespath
become: true
ansible.builtin.apk:
name: py3-jmespath
update_cache: true
register: apk_res
retries: 5
until: apk_res is success
when:
- gitlab_deploy or gitlab_configure
- name: Installing git
become: true
ansible.builtin.apk:
name: git
update_cache: true
register: apt_res
retries: 5
until: apk_res is success
when:
- gitlab_create_jobs
- name: Installing py3-psycopg2
become: true
ansible.builtin.apk:
name: py3-psycopg2
update_cache: true
register: apk_res
retries: 5
until: apk_res is success
when:
- postgres_deploy or cachet_configure
- name: Installing py3-influxdb
become: true
ansible.builtin.apk:
name: py3-influxdb
update_cache: true
register: apk_res
retries: 5
until: apk_res is success
when:
- influxdb_deploy
- name: Installing py3-kubernetes
become: true
ansible.builtin.apk:
name: py3-kubernetes
update_cache: true
register: apk_res
retries: 5
until: apk_res is success
when:
- use_kubernetes
- name: Installing py3-boto3, py3-gitpython, py3-grpcio, py3-protobuf,
py3-s3transfer, py3-smmap2, py3-oauthlib, py3-ruamel.yaml and
py3-ruamel.yaml.clib
become: true
ansible.builtin.apk:
name:
- py3-boto3
- py3-gitpython
- py3-grpcio
- py3-protobuf
- py3-s3transfer
- py3-smmap2
- py3-oauthlib
- py3-ruamel.yaml
- py3-ruamel.yaml.clib
update_cache: true
register: apk_res
retries: 5
until: apk_res is success
when:
- use_kubernetes
- name: Installing python-string-utils, supermutes, pyhelm and openshift
via pip
become: "{{ not lookup('env', 'VIRTUAL_ENV') }}"
ansible.builtin.pip:
name:
- python-string-utils<=1.0.0
- supermutes<=0.2.5
- pyhelm<=2.14.5
- openshift<=0.12.0
extra_args: --no-deps
when:
- use_kubernetes
- name: Installing tar
become: true
ansible.builtin.apk:
name:
- tar
update_cache: true
register: apk_res
retries: 5
until: apk_res is success
when:
- use_kubernetes
11 changes: 9 additions & 2 deletions tasks/docker.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
- name: Ensuring docker service is running
become: true
ansible.builtin.systemd:
ansible.builtin.service:
name: docker
daemon_reload: true
state: started
- name: Adding ansible_user to docker group
become: true
Expand All @@ -22,6 +21,7 @@
mode: '0755'
when:
- "'http_proxy' in ansible_env or 'https_proxy' in ansible_env"
- ansible_service_mgr == "systemd"
- name: Creating /etc/systemd/system/docker.service.d/http-proxy.conf
become: true
ansible.builtin.template:
Expand All @@ -33,6 +33,13 @@
- Restarting Docker
when:
- "'http_proxy' in ansible_env or 'https_proxy' in ansible_env"
- ansible_service_mgr == "systemd"
- name: Forcing systemd to reread configs
ansible.builtin.systemd:
daemon_reload: true
when:
- "'http_proxy' in ansible_env or 'https_proxy' in ansible_env"
- ansible_service_mgr == "systemd"
- name: Creating /etc/docker/daemon.json
become: true
ansible.builtin.template:
Expand Down
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
ansible.builtin.include_tasks: redhat.yml
when:
- ansible_os_family == 'RedHat'
- name: Include alpine.yml in play
ansible.builtin.include_tasks: alpine.yml
when:
- ansible_os_family == 'Alpine'
- name: Include docker.yml in play
ansible.builtin.include_tasks: docker.yml
when:
Expand Down

0 comments on commit b2d7540

Please sign in to comment.