Websoft9 / stackhub

Cloud deployment solution by Ansible
Other
2 stars 0 forks source link

Docker 应用通用安装 #2

Open chendelin1982 opened 2 years ago

chendelin1982 commented 2 years ago

目标

满足 Docker 类应用可以快速生产镜像

需求

  1. 模板化的 Docker 项目可无需修改直接生产,即将 Docker 项目看做是本项目的【插件】
  2. 可在一次生产多应用

设计

  1. 端口、路径、服务名称约定,软连接统一性
  2. Web Server 选择(Nginx, Nginx-GUI, Traefix?)
  3. 数据库 GUI 工具的一对多能力
  4. Docker 网络规划,多个 compose 编排之间如何连通?
  5. 应用随机密码转移到 Docker 项目
  6. ansible 组织结构问题(深度读写 role,galaxy, collection 的组织方式)
  7. ansible 安装应用与Stackhub CLI 安装应用有没有重复劳动?
  8. 应用的端口映射到宿主机要慎重?
qiaofeng1227 commented 2 years ago

ansible collection 中模块和插件区别

qiaofeng1227 commented 2 years ago
ansible-galaxy collection init websoft9.mysql
[root@iZj6c0zfkuoye7ynl2c5mfZ nginx]# tree websoft9
websoft9
└── mysql
    ├── docs
    ├── galaxy.yml
    ├── plugins
    │   └── README.md
    ├── README.md
    └── roles
[root@iZj6c0zfkuoye7ynl2c5mfZ nginx]# ansible-galaxy role init test_role
[root@iZj6c0zfkuoye7ynl2c5mfZ nginx]# tree test_role
test_role
├── defaults
│   └── main.yml
├── files
├── handlers
│   └── main.yml
├── meta
│   └── main.yml
├── README.md
├── tasks
│   └── main.yml
├── templates
├── tests
│   ├── inventory
│   └── test.yml
└── vars
    └── main.yml

[root@iZj6c7cj31hijkg5cfonobZ ~]#  ansible-galaxy init --type apb ansible-test
[root@iZj6c7cj31hijkg5cfonobZ ~]# tree ansible-test/
ansible-test/
├── apb.yml
├── defaults
│   └── main.yml
├── Dockerfile
├── files
├── handlers
│   └── main.yml
├── Makefile
├── meta
│   └── main.yml
├── playbooks
│   ├── deprovision.yml
│   └── provision.yml
├── README.md
├── tasks
│   └── main.yml
├── templates
├── tests
│   ├── ansible.cfg
│   ├── inventory
│   └── test.yml
└── vars
    └── main.yml
qiaofeng1227 commented 2 years ago

image

image

qiaofeng1227 commented 2 years ago

补充一点,role是可以依赖其他远程role的,但是实验一直没成功

qiaofeng1227 commented 2 years ago

collection structure

qiaofeng1227 commented 2 years ago

how to pubulish a self collection? e.g. namaspace:qiaofeng1227 collection:owncloud

ansible-galaxy collection init qiaofeng1227.owncloud
add meta/runtime.yml
[root@iZj6c7cj31hijkg5cfonobZ owncloud]# cat meta/runtime.yml 
requires_ansible: ">=2.9"

[root@iZj6c7cj31hijkg5cfonobZ owncloud]#ansible-galaxy collection build
[root@iZj6c7cj31hijkg5cfonobZ owncloud]# ls
docs  galaxy.yml  meta  plugins  qiaofeng1227-owncloud-1.0.0.tar.gz  README.md  roles

ansible-galaxy collection publish qiaofeng1227-owncloud-1.0.0.tar.gz --api-key XXXX
qiaofeng1227 commented 2 years ago

image

qiaofeng1227 commented 2 years ago

即使是没有role,plugin,module,playbook,也可以发布成功。

chendelin1982 commented 2 years ago

Collection 用途

  1. 被其他 playbook 调用模块
  2. 完成的 project ?
chendelin1982 commented 2 years ago

Collection 用途

  1. 被其他 playbook 调用模块
  2. 完成的 project ?