반응형

Ansible 8

AWX 컬렉션 설치 (requirements.yml)

AWX를 사용하던 도중 Hosts에 등록된 노드들에서 한번에 ssh-key를 생성하고 싶어서 아래 코드를 사용했더니만 오류가 발생하였다.---- name: Create ssh-keygen to Common Hosts hosts: Common # Inventory에서 생성한 Groups tasks: - name: Generate ssh-key community.crypto.openssh_keypair: path: /tmp/id_ssh_rsa  그래서 구글링 해보던 중, requirements.yml 파일을 생성하고 안에 collections 을 정의해주면 된다는 글을 발견..---collections: - name: community.crypto 그 후 Github에 등록 후 Temp..

Ansible 2024.05.17

AWX 시작해보기 (Inventory, Credentials, Projects, Templates)

앞서 AWX 설치는 아래 링크에서 확인하실 수 있습니다.2024.05.13 - [AWS] - AWX 설치 (k8s 환경) AWX 설치 (k8s 환경)AWX란?Ansible을 기반으로 그래픽 인터페이스를 통해 Ansible 플레이북, 인벤토리 및 작업 일정을 중앙 집중화하고 제어할 수 있으므로 인프라 전체에서 자동화 작업을 더 쉽게 관리하고 모니터링할ksh-cloud.tistory.com 목표이번에 해볼 목표는 각 호스트들에 hello.txt 파일을 생성해보겠습니다.1. Inventory 생성Inventory는 AWX에서 관리하는 호스트들을 선택해서 넣을 수 있습니다. [Add] - [Add inventory] 새로운 inventory를 생성 해줍니다. Name: 원하는 이름Organization: 생성해..

Ansible 2024.05.14

AWX 설치 (k8s 환경)

AWX란?Ansible을 기반으로 그래픽 인터페이스를 통해 Ansible 플레이북, 인벤토리 및 작업 일정을 중앙 집중화하고 제어할 수 있으므로 인프라 전체에서 자동화 작업을 더 쉽게 관리하고 모니터링할 수 있게 해주는 오픈소스 툴 입니다.이제 쿠버네티스 클러스터에서 설치를 해보도록 하겠습니다.AWX 설치필요한 패키지 설치# apt install -y git makeawx-operator 설치2-1. 해당 주소에 있는 git 레포지토리에서 파일을 받아옵니다.# git clone https://github.com/ansible/awx-operator.git2-2. git 레포지토리에서 0.17.0 버전으로 변경 (브랜치)# cd awx-operator# git checkout 0.17.02-3. awx 설..

Ansible 2024.05.13

Ansible 사용하여 vSphere 환경에서 가상머신 생성

Ansible을 사용해서 vSphere 환경에서 가상머신 생성해보겠습니다. 1. Ansible 설치 먼저 ansible을 설치해보겠습니다. (OS는 ubuntu 20.04를 사용했습니다.) 패키지 업데이트 # apt update PPA 저장소를 관리할 수 있는 소프트웨어 공통 패키지 설치 # apt install software-properties-common Ansible PPA(Personal Package Archive)를 apt-repository에 추가 # apt-add-repository ppa:ansible/ansible ansible 설치 # apt install -y ansible ansible 버전 확인 # ansible --version ansible-playbook 사용하기 위해 V..

Ansible 2024.03.27

Ansible 사용하여 nginx 설치 및 index 페이지 변경

오늘은 nginx 설치와 index페이지 경로와 파일을 변경하는 것 부터 시작해보겠습니다. nginx의 패키지 명은 nginx 입니다. nginx의 설정파일의 위치는 /etc/nginx/nginx.conf 입니다. nginx 설치 및 설정 명령어 --- - name: 4 server nginx html file create hosts: db tasks: - name: yum install yum: name: "{{ item }}" state: latest loop: - epel-release - nginx - name: change root directory & index file-1 replace: path: /etc/nginx/nginx.conf regexp: 'root /usr/share/nginx..

Ansible 2024.02.14

Ansible 사용하여 WordPress, Haproxy 설정 해보기

Ansible 설치 및 설정에 이어서 진행 해보도록 하겠습니다. 우선 wordpress를 2번 서버에 설치하고 설정하는 작업을 ansible을 사용하여 해보겠습니다. 처음 작성한 코드 --- - name: wordpress down and start hosts: web tasks: - name: wget, httpd install yum: name: "{{ item }}" state: latest loop: - wget - httpd - epel-release - yum-utils - http://rpms.remirepo.net/enterprise/remi-release-7.rpm - php - php-common - php-opcache - php-mcrypt - php-cli - php-gd - ph..

Ansible 2024.02.11

Ansible 모듈 사용해보기 (shell, user, file, copy ...등)

오늘은 모듈 shell, user, file, copy, fetch, yum, service, lineinfile에 대해 알아보았습니다. Ad-hoc 명령어 module: user ansible all -m user -a "name=a" => 모든 서버에 'a'라는 이름의 유저 생성 ansible all -m user -a "name=a state=absent" => 모든 서버에 'a'라는 이름의 유저 삭제 => 다만 user 모듈로 유저 생성 후 삭제하면 /home, /var/spool/mail 디렉토리에 생성된 유저 디렉토리는 삭제 되지 않는다. ansible all -m user -a "name=a update_password=always password={{ 'It1' | password_hash..

Ansible 2024.02.05

Ansible 설치 및 설정

Ansible 체계 구성도 HOSTC7-1C7-2C7-3C7-4 Hostname cont ma1 ma2 ma3 IP 10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.4 SM 255.255.255.0 255.255.255.0 255.255.255.0 255.255.255.0 Default-gateway 10.0.0.254 10.0.0.254 10.0.0.254 10.0.0.254 DNS 168.126.63.1 168.126.63.1 168.126.63.1 168.126.63.1 Roles Controller manage1 manage2 manage3 1. 설치 및 설정 ansible은 SSH를 이용하여 통신을 합니다. 따라서 SSH 통신이 되도록 설정을 해줍니다. 저희는 테스트하는 경우라 ss..

Ansible 2024.01.18
반응형