Fix all the ci

1) Bump pyflakes

We need a python 3.9 compatible version.

Related PyCQA/pyflakes #367

2) Fix missing permissions on files

3) Ignore ansible-lint 106 for role name

4) Fix setup-tools install LP#1902986

5) ensure virtualenv is installed

6) fix missing htpasswd

Change-Id: I8302bc6c9250eba78437ccfec35e4de91348333e
This commit is contained in:
Alex Schultz 2020-11-09 07:51:30 -07:00
parent 7eca2dd091
commit e354ac5fa5
7 changed files with 43 additions and 2 deletions

View File

@ -12,7 +12,8 @@
# this requires refactoring roles, skipping for now # this requires refactoring roles, skipping for now
# 405: Package tasks should have retries. Skipping because yum does # 405: Package tasks should have retries. Skipping because yum does
# this natively. # this natively.
SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016,405" # 106: Role name with a -. We're not using galaxy.
SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016,405,106"
# Lin the role. # Lin the role.
ansible-lint -vvv -x $SKIPLIST ./ || lint_error=1 ansible-lint -vvv -x $SKIPLIST ./ || lint_error=1

View File

@ -44,13 +44,18 @@
virtualenv: "{{ ansible_user_dir }}/test-python" virtualenv: "{{ ansible_user_dir }}/test-python"
virtualenv_site_packages: true virtualenv_site_packages: true
- name: Ensure htpasswd exists
package:
name: httpd-tools
state: present
- name: Create a docker registry - name: Create a docker registry
become: true become: true
shell: |- shell: |-
docker pull ubuntu:16.04 docker pull ubuntu:16.04
docker tag ubuntu:16.04 localhost:5000/my-ubuntu docker tag ubuntu:16.04 localhost:5000/my-ubuntu
mkdir auth mkdir auth
docker run --entrypoint htpasswd registry:2 -Bbn testuser testpassword > auth/htpasswd htpasswd -Bbn testuser testpassword > auth/htpasswd
docker container stop registry docker container stop registry
docker run -d -p 5000:5000 --restart=always --name registry -v "$(pwd)"/auth:/auth -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry:2 docker run -d -p 5000:5000 --restart=always --name registry -v "$(pwd)"/auth:/auth -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry:2
args: args:

View File

@ -12,6 +12,7 @@
template: template:
src: docker-distribution-config.yml.j2 src: docker-distribution-config.yml.j2
dest: /etc/docker-distribution/registry/config.yml dest: /etc/docker-distribution/registry/config.yml
mode: '0644'
become: true become: true
notify: restart docker-distribution service notify: restart docker-distribution service

View File

@ -58,6 +58,7 @@
file: file:
path: /etc/systemd/system/docker.service.d path: /etc/systemd/system/docker.service.d
state: directory state: directory
mode: '0755'
when: ansible_service_mgr == 'systemd' when: ansible_service_mgr == 'systemd'
- name: unset mountflags - name: unset mountflags
@ -67,6 +68,7 @@
option: MountFlags option: MountFlags
value: "" value: ""
create: yes create: yes
mode: '0644'
notify: restart docker service notify: restart docker service
when: ansible_service_mgr == 'systemd' when: ansible_service_mgr == 'systemd'
@ -76,6 +78,7 @@
regexp: '^OPTIONS=' regexp: '^OPTIONS='
line: "OPTIONS='{{ _full_docker_options }}'" line: "OPTIONS='{{ _full_docker_options }}'"
create: yes create: yes
mode: '0644'
notify: restart docker service notify: restart docker service
- name: configure INSECURE_REGISTRY in /etc/sysconfig/docker - name: configure INSECURE_REGISTRY in /etc/sysconfig/docker
@ -83,6 +86,7 @@
path: /etc/sysconfig/docker path: /etc/sysconfig/docker
regexp: '^INSECURE_REGISTRY=' regexp: '^INSECURE_REGISTRY='
line: "INSECURE_REGISTRY='{{ registry_flags }}'" line: "INSECURE_REGISTRY='{{ registry_flags }}'"
mode: '0644'
when: container_registry_insecure_registries | length > 0 when: container_registry_insecure_registries | length > 0
notify: restart docker service notify: restart docker service
vars: vars:
@ -92,6 +96,7 @@
file: file:
path: "{{ item | dirname }}" path: "{{ item | dirname }}"
state: directory state: directory
mode: '0755'
notify: restart docker service notify: restart docker service
with_items: "{{ container_registry_additional_sockets }}" with_items: "{{ container_registry_additional_sockets }}"
when: container_registry_additional_sockets | length > 0 when: container_registry_additional_sockets | length > 0
@ -100,6 +105,7 @@
template: template:
src: docker-daemon.json.j2 src: docker-daemon.json.j2
dest: /etc/docker/daemon.json dest: /etc/docker/daemon.json
mode: '0644'
notify: restart docker service notify: restart docker service
- name: configure DOCKER_STORAGE_OPTIONS in /etc/sysconfig/docker-storage - name: configure DOCKER_STORAGE_OPTIONS in /etc/sysconfig/docker-storage
@ -108,6 +114,7 @@
regexp: '^DOCKER_STORAGE_OPTIONS=' regexp: '^DOCKER_STORAGE_OPTIONS='
line: "DOCKER_STORAGE_OPTIONS=' {{ container_registry_storage_options }}'" line: "DOCKER_STORAGE_OPTIONS=' {{ container_registry_storage_options }}'"
create: yes create: yes
mode: '0644'
when: container_registry_storage_options | length > 0 when: container_registry_storage_options | length > 0
notify: restart docker service notify: restart docker service
@ -117,6 +124,7 @@
regexp: '^DOCKER_NETWORK_OPTIONS=' regexp: '^DOCKER_NETWORK_OPTIONS='
line: "DOCKER_NETWORK_OPTIONS=' {{ container_registry_network_options }}'" line: "DOCKER_NETWORK_OPTIONS=' {{ container_registry_network_options }}'"
create: yes create: yes
mode: '0644'
when: container_registry_network_options | length > 0 when: container_registry_network_options | length > 0
notify: restart docker service notify: restart docker service
@ -152,3 +160,4 @@
line: "# Configured by Ansible container registry role" line: "# Configured by Ansible container registry role"
insertafter: "^# /etc/sysconfig/docker$" insertafter: "^# /etc/sysconfig/docker$"
create: yes create: yes
mode: '0644'

View File

@ -21,6 +21,7 @@
option: DOCKER_NETWORK_OPTIONS option: DOCKER_NETWORK_OPTIONS
value: --iptables=false value: --iptables=false
no_extra_spaces: true no_extra_spaces: true
mode: '0644'
- name: Start Docker daemon - name: Start Docker daemon
service: service:

View File

@ -1 +1,2 @@
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
pyflakes>=2.2.0

View File

@ -67,6 +67,29 @@
version: master version: master
force: true force: true
- name: Ensure virtualenv is installed
include_role:
name: ensure-virtualenv
- name: Set python_v fact to py2 or py3
set_fact:
python_v: "{{ ansible_facts['distribution_major_version'] is version('8', '>=') | ternary('py3', 'py2') }}"
cacheable: true
- name: Install python3-setuptools
package:
name: "python3-setuptools"
state: present
become: true
when: python_v == "py3"
- name: Install python-setuptools
package:
name: "python-setuptools"
state: present
become: true
when: python_v == "py2"
- name: Setup test-python - name: Setup test-python
pip: pip:
name: "{{ molecule_requirements }}" name: "{{ molecule_requirements }}"