반응형
  1. ssh 연결을 위해서 키 생성
    • #ssh-keygen -t rsa
    • 테스트를 위해서 중간에 물어보는 것은 모두 디폴트(엔터)로 설정 함.
    • Enter file which to save the key : 기본적으로 키가 저장되는 폴더
    • Enter passphrase : 암호를 의미하며 필요시 기입
    • 이후 생성되는 내용은 지정된 폴더(기본적으로 현재폴더)의 하위에 숨겨져 있음
    • #ls - al
    • .ssh 폴더를 확인 할 수 있음
    • # cd .ssh
    • id_rsa : 개인키, id_rsa.pub : 공개키
  2. 키 복사
    • ssh-copy-id를 이용하여 Node1, Node2에 id_rsa.pub 파일을 authorized_keys 파일로 복사
      • Host에서 
      • #ssh-copy-id -i ~/.ssh/id_rsa.pub root@node1


      • NODE의 ~/.ssh/authorized_key 파일의 하단에 public key가 복사되고, 해당 node에 접속 시 비밀번호 없이 로그인된다면 성공
    • scp를 이용하여 id_rsa.pub를 authorized_keys로 복사
      • Host에서 
      • #scp id_rsa.pub root@node1:/root/.ssh/authorized_keys 
        • 이미 authorized_keys 파일이 존재할 경우는 id_rsa.pub의 내용을 authorized_keys의 하단에 개행 후 붙여넣어야 함
      • 두 키 값이 동일하면 성공 
      • 이 방식으로는 root에 로그인이 자동으로 되지 않을 가능성이 있음
    • 테스트를 위하여 NODE1, NODE2 모두에 복사
  3. 개인키 사용


반응형
  1. 외부 postgresql에 접속
    • #su - postgres                 ; postgres 사용자로 전환 쉘 프롬프트가 바뀜,   패스워드가 있을 경우 입력 필요함
    • psql 입력
    • 쉘 프롬프트에서 postgres-#으로 변경됨
    •  
  2. 현재 등록된 사용자 조회
    • postgres-# \du
    • 위 화면처럼 awx계정을 생성해야 하며 이와 함께 awx가 사용할 DB도 생성해야 함
    •  
  3. User 생성 (명령어는 대소문자 구별 없음)
    • postgres-# CREATE ROLE awx with superuser password 'awxpass';                   // postgres=# CREATE USER awx with superuser password 'awxpass'; 와 동일한 명령어
    •  
  4. DB 생성
    • postgres-# CREATE DATABASE awxdb OWNER awx                         ; 아주 간단한 명령어 수준으로 기타 옵션들은 필요시 세팅
    •  
  5. postsql 종료
    1. postgres-# \q


반응형
  1. 필요사항
    •  설치 패키지
    • git              ; 버전 관리 시스템의 일종
    • gettext       ; 사용자의 locale에 따라 특정 Message Output에 대한 처리 (참조 : https://wiki.kldp.org/wiki.php/DocbookSgml/Gettext-KLDP)
    • nodejs       ; 자바스크립트 기반으로 작성된 이벤트기반, Non 블로킹 I/O모델을 사용하는 플랫폼 (참조 : https://namu.wiki/w/Node.js)
    • npm           ; node.js 기반의 모듈 집합 저장소 (Node Package Manager 혹은 Node Package Module) (참조 : https://namu.wiki/w/npm)
    • gcc-c++     ; 컴파일러 for c/cpp
    • bzip2         ; 압축 프로그램
    • python-docker-py ; Python libarary for Docker Engine API (참조 : https://docker-py.readthedocs.io/en/stable/https://github.com/docker/docker-py)
    • python-pip ; Python으로 작성된 패키지를 설치/관리 하는 패키지 관리 시스템
    • docker       ; 컨테이너 기술로 여러개의 서비스를 구동 (참조 : https://namu.wiki/w/Docker )  ; 자세한 내용은 추후 Docker 문서 정리 시 링크예정
    • ansible      ; 인프라를 효율적으로 관리하기 위해 구성된 자동화 도구, awx 대응으로 Enterprise 제품인 Ansible Tower가 있음
    • Postgresql9.6-Server     ;외부 Postgersql에 설치하는 방법에 대한 테스트 시 필요 ; optional
  2. 기본 패키지
    • CentOS EPEL 설치     ; EPEL (Extra Package for Enterprise Linux), 필요에 따라 설치된 경우 Skip
      • #sudo yum -y install epel-release 
      • #shutdown -r now
    • 기본 패키지 설치
      • #sudo yum -y install git gettext nodejs npm bzip2 gcc-c++ docker
      • #sudo yum -y install python-docker-py 
      • #sudo yum -y install ansible
    • docker 서비스 시작
      • #sudo systemctl start docker
      • #sudo systemctl enable docker
    • postgresql (optinal)
  3. AWX 다운로드
    • #cd                       ; 현재 로그인된 유저의 기본 디렉토리로 이동
    • #git clone https://github.com/ansible/awx.git
    • #ls                        ; 확인
    • #cd awx/installer
    • 이후 inventory 파일 수정 필요
  4. AWX inventory 파일
    • 아래 내용 중 붉은색으로 표시된 부분만 수정 (각 항목은 추후 업데이트 필요)
    • #vi inventory

      localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python"

      [all:vars]

      # Remove these lines if you want to run a local image build
      # Otherwise the setup playbook will install the official Ansible images. Versions may
      # be selected based on: latest, 1, 1.0, 1.0.0, 1.0.0.123
      # by default the base will be used to search for ansible/awx_web and ansible/awx_task
      dockerhub_base=ansible

      # Openshift Install
      # Will need to set -e openshift_password=developer -e docker_registry_password=$(oc whoami -t)
      # or set -e openshift_token=TOKEN
      # openshift_host=127.0.0.1:8443
      # openshift_project=awx
      # openshift_user=developer
      # openshift_skip_tls_verify=False
      # openshift_pg_emptydir=True

      # Kubernetes Install
      # kubernetes_context=test-cluster
      # kubernetes_namespace=awx
      # tiller_namespace=kube-system

      # Kubernetes and Openshift Install Resource Requests
      # This is the request value for a pod's "task" container, which is the container
      # used to run jobs. The other containers have a fixed resource request. The total amount
      # of requested resources for a pod is the sum of all resources requested by all containers
      # in the pod
      # A cpu_request of 1500 is 1.5 cores for the task container
      # A mem_request of 2 is for 2 gigabytes of memory for the task container
      # task_cpu_request=1500
      # task_mem_request=2

      # Common Docker parameters
      awx_task_hostname=awx
      awx_web_hostname=awxweb 
      postgres_data_dir=/var/awx/pgdocker ; tmp로 되어 있으므로 적당한 위치로 조정
      host_port=80 ; 웹 포트로 필요시 조정, 테스트를 위해서 80 유지

      # Docker Compose Install
      # use_docker_compose=false
      # The docker_compose.yml file will be created in this directory
      # The name of the directory (here "awx") will be the prefix of the docker containers
      docker_compose_dir=/var/lib/awx ;

      # Required for Openshift when building the image on your own
      # Optional for Openshift if using Dockerhub or another prebuilt registry
      # Required for Standalone Docker Install if building the image on your own
      # Optional for Standalone Docker Install if using Dockerhub or another prebuilt registry
      # Required for Docker Compose Install if building the image on your own
      # Optional for Docker Compose Install if using Dockerhub or another prebuilt registry
      # Define if you want the image pushed to a registry. The container definition will also use these images
      # docker_registry=172.30.1.1:5000
      # docker_registry_repository=awx
      # docker_registry_username=developer

      # Docker_image will not attempt to push to remote if the image already exists locally
      # Set this to true to delete images from docker on the build host so that they are pushed to the remote repository
      # docker_remove_local_images=False

      # Set pg_hostname if you have an external postgres server, otherwise
      # a new postgres service will be created
      # pg_hostname=postgresql ; 외부의 postgresql을 사용시 주석을 풀고 해당 ip나 host명을 기입
      pg_username=awx
      pg_password=awxpass
      pg_database=awx
      pg_port=5432

      # RabbitMQ Configuration
      rabbitmq_password=awxpass
      rabbitmq_erlang_cookie=cookiemonster

      # Use a local distribution build container image for building the AWX package
      # This is helpful if you don't want to bother installing the build-time dependencies as
      # it is taken care of already.
      # NOTE: IMPORTANT: If you are running a mininshift install, using this container might not work
      # if you are using certain drivers like KVM where the source tree can't be mapped
      # into the build container.
      # Thus this setting must be set to False which will trigger a local build. To view the
      # typical dependencies that you might need to install see:
      # installer/image_build/files/Dockerfile.sdist
      # use_container_for_build=true

      # This will create or update a default admin (superuser) account in AWX, if not provided
      # then these default values are used
      admin_user=admin ; 초기 AWX 시스템 관리자 아이디
      admin_password=password ; 초기 AWX 시스템 관리자 암호

      # AWX Secret key
      # It's *very* important that this stay the same between upgrades or you will lose the ability to decrypt
      # your credentials
      secret_key=awxsecret

      # Build AWX with official logos
      # Requires cloning awx-logos repo into the project root.
      # Review the trademark guidelines at https://github.com/ansible/awx-logos/blob/master/TRADEMARKS.md
      # awx_official=false

      # Proxy
      #http_proxy=http://proxy:3128
      #https_proxy=http://proxy:3128
      #no_proxy=mycorp.org

      # Container networking configuration
      # Set the awx_task and awx_web containers' search domain(s)
      #awx_container_search_domains=example.com,ansible.com
      # Alternate DNS servers
      #awx_alternate_dns_servers="10.1.2.3,10.2.3.4"

      # AWX project data folder. If you need access to the location where AWX stores the projects

      # this variable causes this directory on the host to be bind mounted over
      # /etc/pki/ca-trust in the awx_task and awx_web containers.
      # NOTE: only obeyed in local_docker install
      ca_trust_dir=/etc/pki/ca-trust/source/anchor ; 주석을 해제 하지 않을 경우 설치 오류 발생함

      # Include /etc/nginx/awx_extra.conf
      # Note the use of glob pattern for nginx
      # which makes include "optional" - i.e. not fail
      # if file is absent
      #extra_nginx_include="/etc/nginx/awx_extra[.]conf"

  5. playbook을 실행
    • #ansible-playbook -i inventory install.yml                                  ; inventory의 내용을 바탕으로 install.yml파일을 실행
  6. 윈도우에서 HOST_AWX의 IP를 입력하여 접속 확인
    • 브라우져 실행 후 http://192.168.xx.xx/ 입력
    • admin/password를 입력하여 로그인
  7. docker 프로세스 확인
    • #docker ps
  8. 방화벽 관련
    • firewalld 설치 및 서비스 등록
      • #sudo install -y firewalld
      • #sudo systemctl start firewalld
      • #sudo systemctl enable firewalld
    • 테스트 환경 접속이 안될경우 방화벽 서비스는 stop 후 확인
      • #sudo systemctl stop firewalld