我正在尝试在 Gitlab-ci 中创建一个管道来运行 ansible-playbook。这是我的 .gitlab-ci.yml 文件:
image: "my_ansible_image"
before_script:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
build:
script:
- ansible-playbook -i inventory -u root --private-key "$SSH_PRIVATE_KEY" playbook.yml -vv
Run Code Online (Sandbox Code Playgroud)
该剧本尝试执行一个简单的 ping 模块:
---
- name: Ping test ## name of the first task
ping: ##ping is a special case that do not requieres any attributs
Run Code Online (Sandbox Code Playgroud)
由于某种原因,ssh 连接总是失败,并出现以下错误:
$ ansible-playbook -i inventory -u root --private-key /builds/my_name/rhe7_set-up-rpm/private_key playbook.yml …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Docker。所以我安装在 Docker postgresql 镜像中。
到目前为止,当我将 osm 数据导入 postql 时,我使用了以下命令:
psql -U postgres mydb
CREATE EXTENSION postgis;
osm2pgsql -U postgres -d mydb -s -S ./osm_stylesheet /home/ramnikov/Downloads/hessen-latest.osm
Run Code Online (Sandbox Code Playgroud)
执行此命令后,我如何在 Docker 内部执行相同操作
$ sudo docker exec -it postgresql sudo -u postgres psql
Run Code Online (Sandbox Code Playgroud)
或在此命令之前?
Tnx
安德烈