增加自检打包和roles 规则

This commit is contained in:
root
2020-07-07 06:23:37 +08:00
parent 2c2efeade0
commit 9fc6d3f40c
6 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
---
- name: "pull image from remote git registry"
docker_image:
name: "{{ item.name }}"
tag: "{{ item.tag }}"
source: pull
with_items: "{{ dockerImages }}"
- name: "add tag"
docker_image:
name: "{{ item.name }}"
repository: "{{ item.repo }}"
force_tag: yes
source: local
with_items: "{{ dockerImages2tags }}"
- name: "Archive image"
docker_image:
name: "{{ item.name }}"
tag: "{{ item.tag }}"
archive_path: "{{ item.tarpath }}"
source: local
with_items: "{{ dockerImagesTar }}"

View File

@@ -0,0 +1,8 @@
---
- name: "download rpm package by rpm list"
yum:
name: "{{ item.name }}"
state: present
download_only: true
download_dir: "{{ item.downpath }}"
with_dict: "{{ rpmlist }}"

View File

@@ -0,0 +1,6 @@
---
- name: "build install tar package"
archive:
path: "{{ tarpath.src }}"
dest: "{{ tarpath.destdict }}{{ tarname }}"
format: gz

View File

@@ -0,0 +1,3 @@
---
- include: ImageDownload.yml
- include: RpmDownload.yml

View File

@@ -0,0 +1,31 @@
---
- name: 'copy file to device'
copy:
src: "{{item.src}}"
dest: "{{item.dest}}"
mode: "{{item.mode}}"
with_items:
- { src: "{{ role_path }}/files/", dest: "/tmp/ansible_deploy/self_test", mode: '0755' }
- name: 'local docker image'
docker_image:
name: "{{item.name}}"
load_path: "{{item.load_path}}"
source: "{{item.source}}"
with_items:
- { name: 'badssl', load_path: '/tmp/ansible_deploy/self_test/images/badssl.tar', source: load }
- { name: 'golang', load_path: '/tmp/ansible_deploy/self_test/images/wpr.tar', source: load }
- { name: 'python', load_path: '/tmp/ansible_deploy/self_test/images/unittest.tar', source: load }
- name: "install kni rpms from localhost"
yum:
name:
- "/tmp/ansible_deploy/self_test/rpms/{{rpmdict.selftest.fullname}}"
state: present
- name: 'self-test service start and docker-compose up'
systemd:
name: self-test
enabled: yes
daemon_reload: yes