OSDN Git Service

PHP環境を作ってみた
authorYoshihiro Saitoh <shupeluter@hotmail.com>
Sat, 6 Nov 2021 13:37:13 +0000 (22:37 +0900)
committerYoshihiro Saitoh <shupeluter@hotmail.com>
Sat, 6 Nov 2021 13:37:13 +0000 (22:37 +0900)
15 files changed:
inventory/hosts
main.yml
roles/00.install/files/sample.php [new file with mode: 0644]
roles/00.install/handlers/main.yml [new file with mode: 0644]
roles/00.install/tasks/main.yml [new file with mode: 0644]
roles/00.install/vars/main.yml [new file with mode: 0644]
roles/common/README.md [deleted file]
roles/common/defaults/main.yml [deleted file]
roles/common/files/main.yml [deleted file]
roles/common/handlers/main.yml [deleted file]
roles/common/meta/main.yml [deleted file]
roles/common/tasks/createUsers.yml [deleted file]
roles/common/tasks/main.yml [deleted file]
roles/common/tests/test.yml [deleted file]
roles/common/vars/main.yml [deleted file]

index 622e7fa..f078d71 100644 (file)
@@ -1,2 +1 @@
-#[HOGEGROUPO]
-#xxx.xxx.xxx.xxx
\ No newline at end of file
+#This Playboot create for localhost, thus there are no need to setting host.
\ No newline at end of file
index 086d0c0..d8b7d15 100644 (file)
--- a/main.yml
+++ b/main.yml
@@ -1,5 +1,5 @@
-- hosts: [hostname]
-  user: [execute user]
+- hosts: localhost
   become: true
+  gather_facts: false
   roles:
-    - [roles]
\ No newline at end of file
+    - 00.install
\ No newline at end of file
diff --git a/roles/00.install/files/sample.php b/roles/00.install/files/sample.php
new file mode 100644 (file)
index 0000000..640e4f2
--- /dev/null
@@ -0,0 +1,3 @@
+<?php
+    phpinfo();
+?>
\ No newline at end of file
diff --git a/roles/00.install/handlers/main.yml b/roles/00.install/handlers/main.yml
new file mode 100644 (file)
index 0000000..1e8e4d5
--- /dev/null
@@ -0,0 +1,5 @@
+- name: restart apache2
+  service:
+    name: apache2
+    state: restarted
+    enabled: yes
\ No newline at end of file
diff --git a/roles/00.install/tasks/main.yml b/roles/00.install/tasks/main.yml
new file mode 100644 (file)
index 0000000..a288475
--- /dev/null
@@ -0,0 +1,14 @@
+- name: install pkgs
+  apt:
+    name: "{{install_pkgs}}"
+    state: present
+    update_cache: true
+  notify:
+    - restart apache2
+
+- name: deliver sample file
+  copy:
+    src: sample.php
+    dest: /var/www/html/info.php
+  notify: 
+    - restart apache2
\ No newline at end of file
diff --git a/roles/00.install/vars/main.yml b/roles/00.install/vars/main.yml
new file mode 100644 (file)
index 0000000..2403835
--- /dev/null
@@ -0,0 +1,4 @@
+install_pkgs:
+  - php
+  - libapache2-mod-php
+  - apache2
\ No newline at end of file
diff --git a/roles/common/README.md b/roles/common/README.md
deleted file mode 100644 (file)
index 225dd44..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-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/common/defaults/main.yml b/roles/common/defaults/main.yml
deleted file mode 100644 (file)
index 7b63570..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
----
-# defaults file for roles/common
\ No newline at end of file
diff --git a/roles/common/files/main.yml b/roles/common/files/main.yml
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/roles/common/handlers/main.yml b/roles/common/handlers/main.yml
deleted file mode 100644 (file)
index 82a964b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
----
-# handlers file for roles/common
\ No newline at end of file
diff --git a/roles/common/meta/main.yml b/roles/common/meta/main.yml
deleted file mode 100644 (file)
index 7223799..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-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: 1.2
-
-  # 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:
-
-  #
-  # platforms is a list of platforms, and each platform has a name and a list of versions.
-  #
-  # 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/common/tasks/createUsers.yml b/roles/common/tasks/createUsers.yml
deleted file mode 100644 (file)
index 5c5abc4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-- name: create users
-  user:
-    name: "{{item.username}}"
-    password: "{{item.password}}"
-  with_items: "{{users}}"
\ No newline at end of file
diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml
deleted file mode 100644 (file)
index 89bd448..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
----
-# tasks file for roles/common
-- name: 01.createUsers
-  include: createUsers.yml
\ No newline at end of file
diff --git a/roles/common/tests/test.yml b/roles/common/tests/test.yml
deleted file mode 100644 (file)
index a6bc661..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
----
-- hosts: localhost
-  remote_user: root
-  roles:
-    - roles/common
\ No newline at end of file
diff --git a/roles/common/vars/main.yml b/roles/common/vars/main.yml
deleted file mode 100644 (file)
index 504cbb7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
----
-# vars file for roles/common
-users:
-  - {username: piwork,password: "{{'piwork'|password_hash('sha512')}}"}
-  
\ No newline at end of file