From b2810e0762cf9db77ac0e41625b8d8c4ba885d2b Mon Sep 17 00:00:00 2001 From: Marcus Gillitzer Date: Wed, 10 Nov 2021 16:40:40 +0100 Subject: [PATCH] =?UTF-8?q?=C3=BCberall=20eingespielt=20aber=20noch=20nich?= =?UTF-8?q?t=20extern=20getestet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playbook.retry | 2 +- playbook.yml | 22 ++++++---- roles/ams_systemd/.travis.yml | 29 +++++++++++++ roles/ams_systemd/README.md | 38 ++++++++++++++++ roles/ams_systemd/defaults/main.yml | 2 + roles/ams_systemd/files/st_ALL.service | 14 ++++++ roles/ams_systemd/handlers/main.yml | 2 + roles/ams_systemd/meta/main.yml | 60 ++++++++++++++++++++++++++ roles/ams_systemd/tasks/main.yml | 52 ++++++++++++++++++++++ roles/ams_systemd/tests/inventory | 2 + roles/ams_systemd/tests/test.yml | 5 +++ roles/ams_systemd/vars/main.yml | 2 + 12 files changed, 220 insertions(+), 10 deletions(-) create mode 100644 roles/ams_systemd/.travis.yml create mode 100644 roles/ams_systemd/README.md create mode 100644 roles/ams_systemd/defaults/main.yml create mode 100644 roles/ams_systemd/files/st_ALL.service create mode 100644 roles/ams_systemd/handlers/main.yml create mode 100644 roles/ams_systemd/meta/main.yml create mode 100644 roles/ams_systemd/tasks/main.yml create mode 100644 roles/ams_systemd/tests/inventory create mode 100644 roles/ams_systemd/tests/test.yml create mode 100644 roles/ams_systemd/vars/main.yml diff --git a/playbook.retry b/playbook.retry index a726c05..03a8fb1 100644 --- a/playbook.retry +++ b/playbook.retry @@ -1 +1 @@ -spolsa5069stu02.spolizei-bw.edu +epolsa5073bit03.tpolizei-bw.de diff --git a/playbook.yml b/playbook.yml index 7964732..51297f8 100644 --- a/playbook.yml +++ b/playbook.yml @@ -28,8 +28,9 @@ #- ams_0017_14.1.4.0_AdminServer #- ams_0019_14.1.6.0 #- ams_0019_14.1.6.0_AdminServer - - ams_0023_14.1.8.0 - - ams_0023_14.1.8.0_AdminServer + #- ams_0023_14.1.8.0 + #- ams_0023_14.1.8.0_AdminServer + - ams_systemd #handlers: @@ -85,8 +86,9 @@ #- enable_import_cv_xml ##- disable_import_cv_xml #- ams_0019_14.1.6.0_enable_monitoring - - ams_0023_14.1.8.0 - - ams_0023_14.1.8.0_AdminServer + #- ams_0023_14.1.8.0 + #- ams_0023_14.1.8.0_AdminServer + - ams_systemd #handlers: #- name: stopALL @@ -125,11 +127,12 @@ #- base_installation #- git #- ams_0008_8.0.8.0 - - ams_sso + #- ams_sso #- ams_0008_8.0.8.0_AdminServer #- ams_0013_8.0.9.0 - - ams_0017_14.1.4.0 - - ams_0017_14.1.4.0_AdminServer + #- ams_0017_14.1.4.0 + #- ams_0017_14.1.4.0_AdminServer + - ams_systemd handlers: @@ -177,8 +180,9 @@ ##- ams_0017_14.1.4.0_AdminServer ##- ams_0019_14.1.6.0 ##- ams_0019_14.1.6.0_AdminServer - - ams_0023_14.1.8.0 - - ams_0023_14.1.8.0_AdminServer + #- ams_0023_14.1.8.0 + #- ams_0023_14.1.8.0_AdminServer + - ams_systemd diff --git a/roles/ams_systemd/.travis.yml b/roles/ams_systemd/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/roles/ams_systemd/.travis.yml @@ -0,0 +1,29 @@ +--- +language: python +python: "2.7" + +# Use the new container infrastructure +sudo: false + +# Install ansible +addons: + apt: + packages: + - python-pip + +install: + # Install ansible + - pip install ansible + + # Check ansible version + - ansible --version + + # Create ansible.cfg with correct roles_path + - printf '[defaults]\nroles_path=../' >ansible.cfg + +script: + # Basic role syntax check + - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + +notifications: + webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/roles/ams_systemd/README.md b/roles/ams_systemd/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/roles/ams_systemd/README.md @@ -0,0 +1,38 @@ +Role Name +========= + +A brief description of the role goes here. + +Requirements +------------ + +Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. + +Role Variables +-------------- + +A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. + +Dependencies +------------ + +A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role: username.rolename, x: 42 } + +License +------- + +BSD + +Author Information +------------------ + +An optional section for the role authors to include contact information, or a website (HTML is not allowed). diff --git a/roles/ams_systemd/defaults/main.yml b/roles/ams_systemd/defaults/main.yml new file mode 100644 index 0000000..4db8f11 --- /dev/null +++ b/roles/ams_systemd/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for default_role \ No newline at end of file diff --git a/roles/ams_systemd/files/st_ALL.service b/roles/ams_systemd/files/st_ALL.service new file mode 100644 index 0000000..3987358 --- /dev/null +++ b/roles/ams_systemd/files/st_ALL.service @@ -0,0 +1,14 @@ +[Unit] +Description=AMS start-/stopALL-Skript + +[Service] +Type=simple +User=jetty +Group=dba +#Environment="AA=bb" +ExecStart=/home/jetty/startALL +ExecStop=/home/jetty/stopALL +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/roles/ams_systemd/handlers/main.yml b/roles/ams_systemd/handlers/main.yml new file mode 100644 index 0000000..cb71395 --- /dev/null +++ b/roles/ams_systemd/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for default_role \ No newline at end of file diff --git a/roles/ams_systemd/meta/main.yml b/roles/ams_systemd/meta/main.yml new file mode 100644 index 0000000..5d50bf4 --- /dev/null +++ b/roles/ams_systemd/meta/main.yml @@ -0,0 +1,60 @@ +galaxy_info: + author: your name + description: your description + company: your company (optional) + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Some suggested licenses: + # - BSD (default) + # - MIT + # - GPLv2 + # - GPLv3 + # - Apache + # - CC-BY + license: license (GPLv2, CC-BY, etc) + + min_ansible_version: 2.4 + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # Optionally specify the branch Galaxy will use when accessing the GitHub + # repo for this role. During role install, if no tags are available, + # Galaxy will use this branch. During import Galaxy will access files on + # this branch. If Travis integration is configured, only notifications for this + # branch will be accepted. Otherwise, in all cases, the repo's default branch + # (usually master) will be used. + #github_branch: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. \ No newline at end of file diff --git a/roles/ams_systemd/tasks/main.yml b/roles/ams_systemd/tasks/main.yml new file mode 100644 index 0000000..d3c84ba --- /dev/null +++ b/roles/ams_systemd/tasks/main.yml @@ -0,0 +1,52 @@ +--- +# tasks file for default_role + + - name: copy st_ALL.service to /etc/systemd/system/st_ALL.service + become_user: root + become: yes + copy: + src: st_ALL.service + dest: /etc/systemd/system/st_ALL.service + owner: root + group: root + mode: 0644 + + - name: delete line ./psc.sh in startALL + become_user: jetty + become: yes + lineinfile: + path: /home/jetty/startALL + regexp: '^./psc.sh' + state: absent + + - name: delete line ./psc.sh in stopALL + become_user: jetty + become: yes + lineinfile: + path: /home/jetty/stopALL + regexp: '^./psc.sh' + state: absent + + - name: reload systemctl daemon-reload + become_user: root + become: yes + systemd: + daemon_reload: yes + + - name: start st_ALL.service + become_user: root + become: yes + systemd: + state: started + name: st_ALL + + - name: enable st_ALL.service + become_user: root + become: yes + systemd: + name: st_ALL + enabled: yes + masked: no + + + diff --git a/roles/ams_systemd/tests/inventory b/roles/ams_systemd/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/ams_systemd/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/ams_systemd/tests/test.yml b/roles/ams_systemd/tests/test.yml new file mode 100644 index 0000000..af33406 --- /dev/null +++ b/roles/ams_systemd/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - default_role \ No newline at end of file diff --git a/roles/ams_systemd/vars/main.yml b/roles/ams_systemd/vars/main.yml new file mode 100644 index 0000000..3bdb116 --- /dev/null +++ b/roles/ams_systemd/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for default_role \ No newline at end of file