본문 바로가기

Automation Tools/Ansible

4.2 ansible | [gitlab] awx 연동 설정

반응형

  1. awx와 연동 계정 : test
  2. gitlab project : http://{gitlab ip}:8080/Ansible-Project/Ansible.git
  3. playbook 제작 등 업로드는 {gitlab server}}:/opt/ansible-gitlab 에서 진행
[root@ansible ansible-gitlab]# pwd
/opt/ansible-gitlab
[root@ansible ansible-gitlab]# ll
total 4
drwxr-xr-x 7 root root 88 Feb 15 17:53 Ansible
-rwxr--r-- 1 root root 78 Feb 15 14:43 git_clone.sh
 
## git clone
[root@ansible ansible-gitlab]# cat git_clone.sh
#!/bin/sh
git clone ssh://git@{gitlab ip}:8022/Ansible-Project/Ansible.git
 
## gitlab ssh key 설정
## gitlab web - test's user settings - ssh keys - {ansible}의 root ssh rsa key 복사
 
## git 설정
git config --global user.name "test"
git config --global user.email "****@****.***"
 
[root@ansible ansible-gitlab]# git config --list
user.name=test
user.email=****@****.***
 
## git push example
[root@ansible playbook]# git add 02.change_service_state.yml
 
[root@ansible playbook]# git commit -m "add 02.change_service_state.yml"
[master 51e85da] add 02.change_service_state.yml
 1 file changed, 9 insertions(+)
 create mode 100644 playbook/02.change_service_state.yml
 
[root@ansible playbook]# git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
 
  git config --global push.default matching
 
To squelch this message and adopt the new behavior now, use:
 
  git config --global push.default simple
 
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
 
Counting objects: 6, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 502 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
To ssh://git@{gitlba ip}:8022/Ansible-Project/Ansible.git
   80ffacb..51e85da  master -> master
반응형