teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

5

修正

2020/01/15 15:50

投稿

big_sky
big_sky

スコア23

title CHANGED
File without changes
body CHANGED
@@ -227,35 +227,6 @@
227
227
  ```
228
228
 
229
229
  ```ここに言語を入力
230
- bitbucket-pipelines.yml
231
-
232
- - composer
233
- deployment: production
234
- script:
235
- # - apt-get update
236
- - apt install -y zip
237
- - cd apps/codeigniter
238
- - sed -i -e "s/<<version>>/$BITBUCKET_TAG/" application/config/app_config.php
239
- - composer install
240
- # - python sitevar.py > vars/site_vars.yml
241
- - zip -r /tmp/artifact.zip .
242
- - cd ../../
243
- - python codedeploy_deploy.py
244
-
245
- definitions:
246
- services:
247
- postgres:
248
- image: postgres
249
- environment:
250
- TZ: "Asia/Tokyo"
251
- POSTGRES_DB: wardishdir
252
- POSTGRES_USER: wardish
253
- DATABASE_URL: postgres://wardish@localhost:5432/wardishdir
254
-
255
-
256
- ```
257
-
258
- ```ここに言語を入力
259
230
  Vagrantfile
260
231
 
261
232
  # -*- mode: ruby -*-

4

追記

2020/01/15 15:50

投稿

big_sky
big_sky

スコア23

title CHANGED
File without changes
body CHANGED
@@ -15,6 +15,190 @@
15
15
  ```ここに言語を入力
16
16
  playbook.yml
17
17
 
18
+ - hosts: all
19
+ become: true
20
+ tasks:
21
+ - name: yum update
22
+ yum:
23
+ name: "*"
24
+ state: latest
25
+ update_cache: yes
26
+
27
+ - name: set timezone to Asia/Tokyo
28
+ timezone:
29
+ name: Asia/Tokyo
30
+
31
+ - name: to selinux
32
+ yum:
33
+ name: libselinux-python
34
+
35
+ - name: install yum repositories
36
+ yum:
37
+ name:
38
+ - epel-release
39
+ - http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
40
+ - https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
41
+
42
+ - name: yarn repo
43
+ shell: yum-config-manager --add-repo https://dl.yarnpkg.com/rpm/yarn.repo; yum makecache fast
44
+ args:
45
+ chdir: /etc/yum.repos.d
46
+ creates: yarn.repo
47
+
48
+ - name: nodejs8 repo
49
+ shell: curl -sL https://rpm.nodesource.com/setup_8.x | bash -
50
+ args:
51
+ creates: /etc/yum.repos.d/nodesource-el7.repo
52
+
53
+ - name: install packages
54
+ yum:
55
+ enablerepo: remi-php56
56
+ name:
57
+ - httpd
58
+ - php
59
+ - php-xml
60
+ - php-pdo
61
+ - php-mbstring
62
+ - php-pgsql
63
+ - php-cli
64
+ - php-common
65
+ - postgresql96
66
+ - postgresql96-contrib
67
+ - postgresql96-server
68
+ - python-psycopg2
69
+
70
+ - name: check database exists
71
+ stat:
72
+ path: /var/lib/pgsql/9.6/data/pg_hba.conf
73
+ register: pgsql_data_hba_conf
74
+
75
+ - name: initdb
76
+ command: /usr/pgsql-9.6/bin/postgresql96-setup initdb
77
+ when: pgsql_data_hba_conf.stat.exists == false
78
+
79
+ - name: edit pg_hba.conf
80
+ lineinfile:
81
+ dest: /var/lib/pgsql/9.6/data/pg_hba.conf
82
+ regexp: '{{ item.regexp }}'
83
+ line: '{{ item.line }}'
84
+ backrefs: yes
85
+ with_items:
86
+ - regexp: '^(local.+) peer$'
87
+ line: '\1 trust'
88
+ - regexp: '^(host.+) ident$'
89
+ line: '\1 trust'
90
+ - regexp: '^(host.+) ident$'
91
+ line: '\1 trust'
92
+
93
+ - name: install composer
94
+ shell: curl -sS https://getcomposer.org/installer| php -- --install-dir=/usr/local/bin && mv /usr/local/bin/composer.phar /usr/local/bin/composer
95
+ args:
96
+ creates: /usr/local/bin/composer
97
+
98
+ - name: make composer executable
99
+ file:
100
+ path: /usr/local/bin/composer
101
+ mode: a+x
102
+ state: file
103
+
104
+ - name: install yarn
105
+ shell: curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
106
+
107
+ - name: import gpg key
108
+ shell: sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
109
+
110
+ - name: install packages
111
+ yum:
112
+ name:
113
+ - nodejs
114
+ - make
115
+ - yarn
116
+ - gcc-c++
117
+
118
+ - name: install webpack
119
+ shell: yarn add webpack webpack-cli
120
+ become: true
121
+ become_user: vagrant
122
+ args:
123
+ chdir: /home/vagrant
124
+
125
+ - name: setting bash_profile
126
+ template:
127
+ src: resources/bash_profile.j2
128
+ dest: /home/vagrant/.bash_profile
129
+
130
+ - name: app.conf
131
+ copy:
132
+ dest: /etc/httpd/conf.d/wardishdir.conf
133
+ content: |
134
+ Alias /wardishdir2 /vagrant/apps/codeigniter
135
+
136
+ SetEnv CI_PUBLIC "public"
137
+ SetEnv CI_DB_NAME "wardish"
138
+ SetEnv CI_DB_USER "wardishdir01"
139
+ SetEnv CI_DB_PASSWORD "wardishdir01"
140
+ SetEnv CI_DB_HOST "localhost"
141
+
142
+ <Directory /vagrant/apps/codeigniter>
143
+ AllowOverride All
144
+ EnableMMAP Off
145
+ EnableSendfile Off
146
+ Require all granted
147
+ </Directory>
148
+
149
+ - name: create directories
150
+ file:
151
+ path: '{{ item }}'
152
+ state: directory
153
+ owner: root
154
+ mode: 777
155
+ with_items:
156
+ - /var/wardishdir/construction/import_files
157
+ - /var/wardishdir/construction/attachment_files
158
+ - /var/wardishdir/log
159
+
160
+ - name: setting php
161
+ lineinfile:
162
+ dest: /etc/php.ini
163
+ state: present
164
+ backrefs: yes
165
+ regexp: '{{ item.regexp }}'
166
+ line: '{{ item.line }}'
167
+ with_items:
168
+ - regexp: '^;(date.timezone) =.*'
169
+ line: '\1 = Asia/Tokyo'
170
+ - regexp: '^;(mbstring.language) =.*'
171
+ line: '\1 = Japanese'
172
+ - regexp: '^;(mbstring.internal_encoding) =.*'
173
+ line: '\1 = UTF-8'
174
+ - regexp: '^;(mbstring.http_input) =.*'
175
+ line: '\1 = pass'
176
+ - regexp: '^;(mbstring.http_output) =.*'
177
+ line: '\1 = pass'
178
+ - regexp: '^;(mbstring.encoding_translation) =.*'
179
+ line: '\1 = off'
180
+
181
+ - name: start services
182
+ service:
183
+ name: '{{ item }}'
184
+ enabled: yes
185
+ state: restarted
186
+ with_items:
187
+ - httpd
188
+ - postgresql-9.6
189
+
190
+ - name: create role
191
+ postgresql_user:
192
+ name: wardish
193
+ password: wardishdir02
194
+ expires: infinity
195
+ login_user: postgres
196
+ login_host: localhost
197
+
198
+ - name: create database
199
+ postgresql_db:
200
+ name: wardishdir
201
+ encoding: UTF-8
18
202
  template: template0
19
203
  owner: wardish
20
204
  login_user: postgres
@@ -96,53 +280,5 @@
96
280
 
97
281
  ```
98
282
 
99
-
100
- ```ここに言語を入力
101
- /etc/ansible/hosts
102
-
103
- # This is the default ansible 'hosts' file.
104
- #
105
- # It should live in /etc/ansible/hosts
106
- #
107
- # - Comments begin with the '#' character
108
- # - Blank lines are ignored
109
- # - Groups of hosts are delimited by [header] elements
110
- # - You can enter hostnames or ip addresses
111
- # - A hostname/ip can be a member of multiple groups
112
-
113
- # Ex 1: Ungrouped hosts, specify before any group headers.
114
-
115
- ## green.example.com
116
- ## blue.example.com
117
- ## 192.168.100.1
118
- ## 192.168.100.10
119
-
120
- # Ex 2: A collection of hosts belonging to the 'webservers' group
121
-
122
- ## [webservers]
123
- ## alpha.example.org
124
- ## beta.example.org
125
- ## 192.168.1.100
126
- ## 192.168.1.110
127
-
128
- # If you have multiple hosts following a pattern you can specify
129
- # them like this:
130
-
131
- ## www[001:006].example.com
132
-
133
- # Ex 3: A collection of database servers in the 'dbservers' group
134
-
135
- ## [dbservers]
136
- ##
137
- ## db01.intranet.mydomain.net
138
- ## db02.intranet.mydomain.net
139
- ## 10.25.1.56
140
- ## 10.25.1.57
141
-
142
- # Here's another example of host ranges, this time there are no
143
- # leading 0s:
144
-
145
- ## db-[99:101]-node.example.com
146
- ```
147
283
  他にもvagrant mount フォルダ共有ができない問題などがありましたが、そこはvagrant plugin install vagrant-vbguestで解決することができ、最後にこのエラーとずっと向き合っています。
148
284
  どなたか助言をいただけると助かります。

3

修正

2020/01/15 15:49

投稿

big_sky
big_sky

スコア23

title CHANGED
File without changes
body CHANGED
@@ -96,36 +96,31 @@
96
96
 
97
97
  ```
98
98
 
99
+
99
100
  ```ここに言語を入力
100
- /etc/ansible/ansible.cfg
101
+ /etc/ansible/hosts
101
102
 
102
- [colors]
103
- #highlight = white
103
+ # This is the default ansible 'hosts' file.
104
+ #
104
- #verbose = blue
105
+ # It should live in /etc/ansible/hosts
106
+ #
105
- #warn = bright purple
107
+ # - Comments begin with the '#' character
106
- #error = red
107
- #debug = dark gray
108
- #deprecate = purple
109
- #skip = cyan
110
- #unreachable = red
108
+ # - Blank lines are ignored
111
- #ok = green
112
- #changed = yellow
113
- #diff_add = green
109
+ # - Groups of hosts are delimited by [header] elements
114
- #diff_remove = red
110
+ # - You can enter hostnames or ip addresses
115
- #diff_lines = cyan
111
+ # - A hostname/ip can be a member of multiple groups
116
112
 
113
+ # Ex 1: Ungrouped hosts, specify before any group headers.
117
114
 
118
- [diff]
119
- # Always print diff when running ( same as always running with -D/--diff )
115
+ ## green.example.com
120
- # always = no
116
+ ## blue.example.com
117
+ ## 192.168.100.1
118
+ ## 192.168.100.10
121
119
 
122
- # Set how many context lines to show in diff
120
+ # Ex 2: A collection of hosts belonging to the 'webservers' group
123
- # context = 3
124
- ```
125
- ```ここに言語を入力
126
- /etc/ansible/hosts
127
121
 
128
-
122
+ ## [webservers]
123
+ ## alpha.example.org
129
124
  ## beta.example.org
130
125
  ## 192.168.1.100
131
126
  ## 192.168.1.110

2

追記

2020/01/15 15:35

投稿

big_sky
big_sky

スコア23

title CHANGED
File without changes
body CHANGED
@@ -96,5 +96,58 @@
96
96
 
97
97
  ```
98
98
 
99
+ ```ここに言語を入力
100
+ /etc/ansible/ansible.cfg
101
+
102
+ [colors]
103
+ #highlight = white
104
+ #verbose = blue
105
+ #warn = bright purple
106
+ #error = red
107
+ #debug = dark gray
108
+ #deprecate = purple
109
+ #skip = cyan
110
+ #unreachable = red
111
+ #ok = green
112
+ #changed = yellow
113
+ #diff_add = green
114
+ #diff_remove = red
115
+ #diff_lines = cyan
116
+
117
+
118
+ [diff]
119
+ # Always print diff when running ( same as always running with -D/--diff )
120
+ # always = no
121
+
122
+ # Set how many context lines to show in diff
123
+ # context = 3
124
+ ```
125
+ ```ここに言語を入力
126
+ /etc/ansible/hosts
127
+
128
+
129
+ ## beta.example.org
130
+ ## 192.168.1.100
131
+ ## 192.168.1.110
132
+
133
+ # If you have multiple hosts following a pattern you can specify
134
+ # them like this:
135
+
136
+ ## www[001:006].example.com
137
+
138
+ # Ex 3: A collection of database servers in the 'dbservers' group
139
+
140
+ ## [dbservers]
141
+ ##
142
+ ## db01.intranet.mydomain.net
143
+ ## db02.intranet.mydomain.net
144
+ ## 10.25.1.56
145
+ ## 10.25.1.57
146
+
147
+ # Here's another example of host ranges, this time there are no
148
+ # leading 0s:
149
+
150
+ ## db-[99:101]-node.example.com
151
+ ```
99
152
  他にもvagrant mount フォルダ共有ができない問題などがありましたが、そこはvagrant plugin install vagrant-vbguestで解決することができ、最後にこのエラーとずっと向き合っています。
100
153
  どなたか助言をいただけると助かります。

1

追記

2020/01/15 15:13

投稿

big_sky
big_sky

スコア23

title CHANGED
File without changes
body CHANGED
@@ -12,5 +12,89 @@
12
12
  visible above. Please fix these errors and try again.
13
13
  ```
14
14
 
15
+ ```ここに言語を入力
16
+ playbook.yml
17
+
18
+ template: template0
19
+ owner: wardish
20
+ login_user: postgres
21
+ login_host: localhost
22
+
23
+ - name: grant all to wardishdir
24
+ postgresql_privs:
25
+ db: wardishdir
26
+ type: group
27
+ objs: wardish
28
+ roles: postgres
29
+ login_user: postgres
30
+ login_host: localhost
31
+
32
+ - name: create extensions
33
+ postgresql_ext:
34
+ db: wardishdir
35
+ login_user: postgres
36
+ login_host: localhost
37
+ name: '{{ item }}'
38
+ with_items:
39
+ - pgcrypto
40
+ - pg_trgm
41
+
42
+
43
+ ```
44
+
45
+ ```ここに言語を入力
46
+ bitbucket-pipelines.yml
47
+
48
+ - composer
49
+ deployment: production
50
+ script:
51
+ # - apt-get update
52
+ - apt install -y zip
53
+ - cd apps/codeigniter
54
+ - sed -i -e "s/<<version>>/$BITBUCKET_TAG/" application/config/app_config.php
55
+ - composer install
56
+ # - python sitevar.py > vars/site_vars.yml
57
+ - zip -r /tmp/artifact.zip .
58
+ - cd ../../
59
+ - python codedeploy_deploy.py
60
+
61
+ definitions:
62
+ services:
63
+ postgres:
64
+ image: postgres
65
+ environment:
66
+ TZ: "Asia/Tokyo"
67
+ POSTGRES_DB: wardishdir
68
+ POSTGRES_USER: wardish
69
+ DATABASE_URL: postgres://wardish@localhost:5432/wardishdir
70
+
71
+
72
+ ```
73
+
74
+ ```ここに言語を入力
75
+ Vagrantfile
76
+
77
+ # -*- mode: ruby -*-
78
+ # vi: set ft=ruby :
79
+
80
+ Vagrant.configure(2) do |config|
81
+
82
+ config.vm.provider "virtualbox" do |v|
83
+ v.name = "wardishdir"
84
+ v.memory = "2048"
85
+ end
86
+
87
+ config.vm.box = "bento/centos-7.3"
88
+
89
+ config.vm.network "private_network", ip: "192.168.33.19"
90
+
91
+ config.vm.provision :ansible_local do |ansible|
92
+ ansible.playbook = "playbook.yml"
93
+ end
94
+
95
+ end
96
+
97
+ ```
98
+
15
99
  他にもvagrant mount フォルダ共有ができない問題などがありましたが、そこはvagrant plugin install vagrant-vbguestで解決することができ、最後にこのエラーとずっと向き合っています。
16
100
  どなたか助言をいただけると助かります。