From 8207c6ded1df922d19394f5433ce1fc95b9d6b33 Mon Sep 17 00:00:00 2001 From: zeus Date: Fri, 4 Mar 2022 17:33:26 +0200 Subject: [PATCH] add cloud info --- CloudComputing_Lab/modules/ROOT/nav.adoc | 1 + .../modules/ROOT/pages/ansible.adoc | 208 ++++++++++++++++++ .../modules/ROOT/pages/index.adoc | 3 +- 3 files changed, 211 insertions(+), 1 deletion(-) create mode 100755 CloudComputing_Lab/modules/ROOT/pages/ansible.adoc diff --git a/CloudComputing_Lab/modules/ROOT/nav.adoc b/CloudComputing_Lab/modules/ROOT/nav.adoc index ec3e3a0..ec79c8b 100644 --- a/CloudComputing_Lab/modules/ROOT/nav.adoc +++ b/CloudComputing_Lab/modules/ROOT/nav.adoc @@ -8,4 +8,5 @@ * xref:docker-build.adoc[DigitalSkills-docker_build] * xref:docker-compose.adoc[DigitalSkills-deploy_service] * xref:admin.adoc[DigitalSkills-Service_Admin] +* xref:ansible.adoc[DigitalSkills-OS_Admin] * xref:tech-list.adoc[Getting_started] diff --git a/CloudComputing_Lab/modules/ROOT/pages/ansible.adoc b/CloudComputing_Lab/modules/ROOT/pages/ansible.adoc new file mode 100755 index 0000000..2133075 --- /dev/null +++ b/CloudComputing_Lab/modules/ROOT/pages/ansible.adoc @@ -0,0 +1,208 @@ + += CaaS - OS Admin + +== Playbook + +[source,sh] +---- +--- +- hosts: service + remote_user: docker + gather_facts: no + vars: + user: "docker" + + tasks: + + # ------------------------ + # apt update + # ------------------------- + - name: apt update packages + become: true + apt: + update_cache: 'yes' + force_apt_get: 'yes' + upgrade: 'dist' + cache_valid_time: 3600 + install_recommends: true + autoremove: true + + # ------------------------ + # apt install packages + # ------------------------- + - name: apt install packages + become: true + apt: + update_cache: 'yes' + force_apt_get: 'yes' + install_recommends: true + autoremove: true + name: "{{ packages }}" + vars: + packages: + - build-essential + - git + - flex + - bison + - traceroute + - curl + - lynx + - ruby + - ruby-dev + + # ------------------------ + # directory4example fluentd + # ------------------------- + - name: make /var/log-in + become: true + file: + path: "/var/log-in" + state: directory + owner: docker + group: docker + mode: '0777' + + # ------------------------ + # gem begin + # ------------------------- + - name: make dir for gem + become: true + file: + path: "/home/docker/.gem" + state: directory + owner: docker + group: docker + mode: '0755' + + - name: gem install fluentd + #become: true + gem: + name: fluentd + version: 1.12.0 + state: present + environment: + CONFIGURE_OPTS: '--disable-install-doc' + PATH: '/home/docker/.gem/ruby/2.5.0/bin:{{ ansible_env.PATH }}' + + - name: gem install fluent-plugin-mongo + #become: true + gem: + name: fluent-plugin-mongo + state: present + + - name: gem install oj + #become: true + gem: + name: oj + state: present + + - name: gem install json + #become: true + gem: + name: json + state: present + + - name: gem install async-http + #become: true + gem: + name: async-http + version: 0.54.0 + state: present + + - name: gem install ext-monitor + #become: true + gem: + name: ext_monitor + version: 0.1.2 + state: present + + # ------------------------ + # gem end + # ------------------------- + + # ------------------------ + # add group + # ------------------------- +# - name: add group fluent +# become: true +# group: +# name: fluent +# state: present +# + # ------------------------ + # add user + # ------------------------- +# - name: add user gem +# become: true +# user: +# name: fluent +# group: fluent + + # ------------------------ + # mkdir directory4 fluent + # ------------------------- + - name: make dir fluentd + become: true + file: + path: "/fluentd/etc" + state: directory + owner: docker + group: docker + mode: '0755' + + - name: make dir fluentd + become: true + file: + path: "/fluentd/plugins" + state: directory + owner: docker + group: docker + mode: '0755' + + # ------------------------ + # cp fluentd.conf + # ------------------------- + - name: cp fluentd.conf + become: true + copy: + src: "./files/fluent.conf" + dest: /fluentd/etc/fluent.conf + owner: docker + group: docker + mode: 0755 + + # ------------------------ + # start fluentd + # ------------------------- + - name: start fluentd background + shell: nohup /home/docker/.gem/ruby/2.5.0/bin/fluentd -c /fluentd/etc/fluent.conf -vv /dev/null 2>&1 & + + # ------------------------ + # example4net tcpdump example + # ------------------------- +# - name: google.com +# become: yes +# become_user: "{{ user }}" +# command: curl http://www.google.com +# ignore_errors: yes +# register: configwww +# +# - name: ls configwww +# debug: var=configwww.stdout_lines +# +# - name: ls -al /var/lab/playground/playground-readmongo/ +# become: yes +# become_user: "{{ user }}" +# #command: ls -al /var/lab/playground/playground-readmongo +# command: netstat -antlupe +# ignore_errors: yes +# register: config +# +# - name: ls config +# debug: var=config.stdout_lines +# +# - name: Refresh connection +# meta: clear_host_errors +# + +---- diff --git a/CloudComputing_Lab/modules/ROOT/pages/index.adoc b/CloudComputing_Lab/modules/ROOT/pages/index.adoc index a0c7a66..9e9ee92 100644 --- a/CloudComputing_Lab/modules/ROOT/pages/index.adoc +++ b/CloudComputing_Lab/modules/ROOT/pages/index.adoc @@ -19,7 +19,7 @@ == Learning Scheduler -=== Lab +=== Lab sections * xref:ROOT:a.adoc[Setting Up The Lab Environment] * xref:ROOT:b.adoc[reate service] @@ -33,6 +33,7 @@ * xref:ROOT:docker-build.adoc[docker build --> a simple Node.js application] * xref:ROOT:docker-compose.adoc[Deploy service] * xref:ROOT:admin.adoc[Service Admin] +* xref:ROOT:ansible.adoc[OS Admin] == Intro